
Task2 (make use of the information from Lesson 3)
1) A student has a percentage mark for an examination. These marks should be converted to grades as follows:
>=70 'A', 60-69 'B', 50-59 'C', 40-49 'D', 30-39 'E', <30 'F'
Write a C++ program. Use a switch statement to directly assign the appropriate grade given a percentage mark.
2) A student can get a grade from 'A' to 'F' for a test. Assign the following marks to these grades, 10 for 'A', 8 for 'B', 6 for 'C', 4 for 'D', 2 for 'E' and 0 for 'F'.
3) Using the case operator, write a C++ program. Input data should be typed in from the keyboard. Find the reminder after dividing x by 3. Calculate y:
4) Write a program that is able to compute some operations on an integer. The program writes the value of the integer and the following menu :
1. Add 1
2. Multiply by 2
3. Subtract 4
4. Quit
The program should ask a user to type in a value between 1 and 4. If the user types in a value from 1 to 3 the operation is computed, the integer is written and the menu is displayed again. If the user types 4, the program quits.
5) Write a C++ program which asks a user to enter x and y numbers. Then he/she should enter one of the symbols: +, -, *, / and the program should output the result of that operation.
6)
Read in an integer value (m,
).
Assume that it is the number of a month of the year; print out the
name of that month.
7)
Read an integer value (w,
).
Assume that it is the number of a day of the week; print out the name
of the day.
8)
Read in an integer value (s,
).
Assume that it is the number of a season of the year; print out the
name of the season.
9) Write a C++ program employing the case operator. Input data should be typed in from the keyboard. Calculate the total area of geometric figure.
10)
Read in an integer value (d,
).
Assume that it is the number of a month of the year; print out the
number of days of the month.
11) Write a program that reads in the first letter of the week day from the screen and prints out the name of the day.
12) Write a program that reads in the first letter of the month from the screen and prints out the name of the month.
13) Write a program that performs the following: if the value of letter (that is printed by a user) is 'A', 'E', 'I', 'O' or 'U' then numberofvowels is incremented. If the value of letter is ' ' (a space) then numberofspaces is incremented. If none of these is true then the default condition is executed, that is numberofconstants is incremented.
14) Write a C++ program employing the case operator. Input data should be typed in from the keyboard. You have sequence of symbols: 'a', 'b', 'c', 'd', 'e', 'v', 'x', '.', ',', ':'. Classify this symbols into:
vowels;
consonant;
punctuation marks.
Type in a symbol from the keyboard. Display the symbol and his group.
15) Write a C++ program which classifies symbols into:
Latin letters;
numbers;
brackets.
16) Write a C++ program to analyze the coordinates entered by a user. Find their location on yje plane and show a message: “coordinate point lies in the 1st quarter (X and Y - positive)”, … 'coordinate point lies in the 4th quarter (X and Y - negative)', ' coordinate point is on the X axis', etc.
17) Write a C++ program which will ask a user to enter a number, for example ‘244’ and will output a text ‘two four four’.
18) Write a program that asks a user to type in a name and prints out person’s detail (cell number, address, and nickname). Provide the information about 5 different people.
19) Write a program to show yuor scheduale for a day. It should ask a user to type in the time of the day and prints out particular note. Prepare additional conditions for the time that is not in the list.
20) Write a program that asks a user to type in a name of a student and prints out the debts for particular one. Prepare additional condition for names that are not in the list.
21)
Write a C++ program employing the case operator. Input data should be
typed in from the keyboard.
;
22) Write a program that prints the insurance fee to pay for a pet according to the following rules:
A dog that has been neutered costs $50.
A dog that has not been neutered costs $80.
A cat that has been neutered costs $40.
A cat that has not been neutered costs $60.
A bird or reptile costs nothing.
Any other animal generates an error message.
The program should prompt the user for the appropriate information, using a code to determine the kind of an animal (i.e. D or d represents a dog, C or c represents a cat, B or b represents a bird, R or r represents a reptile, and anything else represents some other kind of an animal). After printing the insurance fee, the program should ask the user if (s)he wants to insure another animal.
23) Write a C++ program which will ask a user to enter a text, for example ‘four two three’ and which will output a number ‘423’.
24) A company pays to its employees according to different schedules. All employees are paid an annual salary. Type 0 employees get paid every week. Type 1 employees are paid twice a month. Type 2 employees are paid once a month. Write a program that calculates the salary paid to each employee.
25) Write a program that calculates how much money (tips) you can give for the service. We suggest 20% of the food cost for a good service; 15% of the food cost for a bad service.
26) Write a program that uses a switch statement to examine the number of days for months containing less than 31 days.
27) Write a program that asks a user to enter the number of a month of the year and the year. For example, if the user wants to enter June, 2005, he/she would enter 6 and then 2005. The program should then display the number of days in the month. Be sure to take leap years into account.
28) Write a program to help balance user’s money market checking account. The program should start by asking a user for the month's opening account balance. Then it should display a menu listing the following choices: D for a deposit, C for a check, W for a withdrawal, and Q for quit. If the user selects D, ask the user to enter the amount of the deposit, and add the amount to the account balance. If the user enters C, ask the user for the amount of the check, and subtract the check amount from the balance. If the user enters W, ask the user for the amount of the withdrawal, and subtract the amount from the balance. When the user enters Q, the program should display the opening balance, the total amount deposited, the total amount withdrawn, the total amount of the checks, and the final balance. If the user enters something other than D, W, C, or Q, the program should issue an error message and redisplay the menu. Allow the user to enter either uppercase or lowercase letters.
29) A commodities broker requires a program to calculate brokerage commissions. Write a program that asks a user if the transaction was a sale or a purchase and then requires for the amount of the transaction. The program should then ask where the transaction was made. The user should enter E for the Commodity Exchange, C for the New York Cotton Exchange, or M for the Mercantile Exchange. If the amount was a sale, and was made at the Commodity Exchange, the commission rate is 5.0% of the amount. If a sale is made at the New York Cotton Exchange, the commission rate is 3.7% of the amount. If a sale is made at the Mercantile Exchange, the commission rate is 4.2% of the amount. If the transaction was a purchase at the Commodity Exchange, the rate commission is 6.3% of the amount. If a purchase is made at the Cotton Exchange, the commission rate is 4.3% of the amount. If a purchase is made at the Mercantile Exchange, the commission rate is 5.7% of the amount. The program should process any number of transactions.
30) Your city's Parking Violation Bureau wants you to write a program to compute fines for parking violations. There are four types of violation: type A claims a fine of $10, type B claims a fine of $20, type C claims a fine of $30, and type D claims a fine of $50. The program should ask for the number of the type A violations, the number of the type B violations, and so on. If the number of A, B, or C violations exceeds 10, impose an additional fine of $50 for each category that exceeds 10. If the total number of A, B, or C violations exceeds 20 but none of A, B, or C individually exceeds 10, impose an additional fine of $75. If the number of D violations exceeds three, impose an additional fine of $20 for each D violation over three. The program should display the total fine for a person and any number of people.