Computer Science 1081 – Assignment #02

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (1 vote)

Program #1
Write a program that computes the tax and tip on a restaurant bill for a meal charge. The tax should be 6.75 percent of the meal cost. The tip should be 20 percent of the total after adding the tax. Display the meal cost, tax amount, tip amount, and total bill on the screen.
• Use a const (constant) for the tax and tip rates (0.0675 and 0.2 respectively)
• Ask the user for the cost of the meal
Sample Output:
Meal: $85.45
Tax: $5.76788
Tip: $18.2436
Total: $109.461
Press any key to continue . . .
Test Cases to try and think about:
• How does your program respond when the values entered are negative?
• How does your program respond when the values entered are smaller than a penny?

Program #2
You have been given a job as a programmer on a Cyborg supercomputer. In order to accomplish some calculations, you need to know how many bytes the following data types use: char, int, float, and double. You do not have any manuals, so you can’t look this information up. Write a C++ program that will determine the amount of memory used by these types and display the information on the screen.
• Do not use any numeric literals; use the sizeof function to produce the correct sizes. Sample Output:
char 1
int 4
float 4
double 8
Press any key to continue . . .

Program #3
Kathryn bought 750 shares of stock at a price of $35.00 per share. She must pay her stockbroker a 2 percent commission for the transaction. Write a program that calculates and displays the following: The amount paid for the stock alone (without the commission); The amount of the commission; and the total amount paid (for the stock plus the commission). Generalize the program so that Kathryn can use it for other situations as well.
• Have your program ask the user for the number of shares and the price per share
• Use a const for the commission (0.02)
Sample Output:
Enter the number of shares: 25152
Enter the price per share: 12.5
Stock: $314400
Commission: $6288
Total: $320688
Press any key to continue . . .
Test Cases to try and think about:
• How does your program respond when the values entered are negative?
• How does your program respond when the values entered are smaller than a penny?
• Can you enter a fractional number of shares?