Task
This assessment is consist of 5 tasks. You need to prepare the following for each question
- Programming object list
- Algorithm
- C++ Coding
Scenario 1: Mathematics operation
Write a C++ program that will display the calculator menu. The program will prompt the user to choose the operation choice (from 1 to 5). Then it asks the user to input two integer vales for the calculation.
Example1
2
3
4
5
6
7
8MENU
1. Add
2. Subtract
3. Multiply
4. Divide
5. Modulus Enter your choice: 1
Enter your two numbers: 12 15 Result: 27
Continue? y
Scenario 2: Sorting Number
Write a C++ program (using function overloaded) to sort 10 integer values, or 10 long values, or 10 double values. Number lists provide below:1
2valListInt = 23, 2, 34, 23, 43, 22, 32, 32, 43, 34
valListLong = 7000, 15, 34, 2373645, 43, 22, 9392929294, 46, 32, 111143 valListDbl = 23.3847239, 2.3974, 34.183734, 23.0, 43.36381, 22.3, 32.0, 32.1919, 43.938363, 34.38364
Scenario 3: Order number
Create the C++ Function named multiples so that it has two parameters x, and n. The first parameter x will be overloaded with int, double and float. n will always be int. The return type is void. A Function created from multiples will compute.1
2
3sum = 1 + x + 2x + 3x + … + nx e.g n = 4
sum = 1 + x + 2x + 3x + 4x
and display the result on screen.
Scenario 4: Temperature record
Write a program that takes a maximum and minimum temperature of the city from Monday to Sunday, and three functions that calculate on average temperature, maximum temperature and minimum temperature of that week.
Example1
2
3
4
5
6
7
8
9
10
11
12Please enter this week temperature,
Monday: 19.0 14.0
Tuesday: 24.5 12.5
Wednesday: 22.0 9.5
Thursday: 17.0 9.0
Friday: 17.0 10.0
Saturday: 23.0 12.0
Sunday: 22.0 15.5
This week,
minimum temperature is: 9.0
maximum temperature is: 24.5
average temperature is: 16.21
Scenario 5: String and Character Function
Write a program that reads in a string provided the user. Return the following statistics about the string:1
2
3
4
5
6Length
Number of vowels
Number of lower case characters
Number of upper case characters
Number of numerals
Number of other symbols