Find and fix the error(s) in the following program.
using namespace std;
int MAIN()
cout << “Hello << World; int name;
cout << “Type your name:”;
cin << name;
cout >> “Hello, “ << << name;
}
Problem 2 Concert Tickets
There are three tickets for a concert. The VIP tickets cost $120, premium tickets cost $80, and regular tickets cost $40. Prompt the user how many tickets of each category he would like. Then print an invoice with overview of the order and total price. Include a sales tax of 9.25%.
How many tickets would you like to order? VIP Tickets ($120): 0
Premium Tickets ($80): 4
Regular Tickets ($40): 2
Invoice:
VIP: $120 x 0 = $ 0.00
Premium: $ 80 X 4 = $320.00
Regular: $ 40 x 2 = $ 80.00
Sales Tax: 9.25% = $ 37.00 —————————— Total Price: $437.00
1 Santa Monica College
CS 52 – C++ Programming
Problem 3 Program a Calculator
Write a program that can be used as a calculator. Prompt the user to enter which operation he/she would like to perform, that is addition, subtraction, multiplication, or division. Use a switch statements to properly handle the operator entered by the user. Then prompt the user to enter two operands. An example of the program may look like this:
Calculator
——————-
What operation would you like to perform?
Addition (+), Subtraction (-), Multiplication (*), or Division (/)
Enter an operator: +
Enter operand 1: 23
Enter operand 2: 45
The results is: 23 + 45 = 78Problem 4 Months
Write a program that determines the season based on the month. The program prompts a user to enter a month (1-12) and then prints if that month is in spring, summer fall or winter. The program must also check if a valid month was entered. For simplicity, assume: 1-3: spring, 4-6: summer, 7-9 fall, 10-12 winter.
Enter a month (1-12): -5 Enter a month (1-12): 7 That is not a valid month! The 7. month is in fall!
OR OR
Enter a month (1-12): 3 Enter a month (1-12): 14
The 3. month is in spring! That month must be in the future.
Reviews
There are no reviews yet.