Write a C++ program that displays a calculation menu as shown below:
Calculation Menu
1. Multiplication Table
2. Prime Number
3. Sort Numbers
4. Quit
For examples:
If the user enters 1, the program should ask to enter one integer value from 1 to 12 and then display the following multiplication table:
Example :
If input : 7
The output that will be displayed :
Muliplication of 7
1 X 7 = 7
2 X 7 = 14
.
.
.
12 X 7 = 84
If the user enters 2, the program should ask to enter a set of N integers. Find the total number of prime numbers in the list of data entered. Given below is an example of an algorithm to find a prime number.
Pseudocode
Mula
Kira <- 0
Baca N
Ulang
Baca Nom
Kira Kira + 1
BilBolehBahagi 0
Pembahagi 0
Ulang
Pembahagi Pembahagi + 1
Jika Baki(Nom/Pembahagi)=0 Maka
BilBolehBahagi BilBolehbahagi + 1
Sehingga (Pembahagi=Nom)
Jika BilBolehBahagi = 2 Maka
BilPrimeNo BilPrimeNo + 1
Sehingga (Kira=N)
Cetak BilPrimeNo
Tamat
If the user enters 3, the program should ask to enter a series of N integers and sort the numbers in ascending order.
The program must be able to prompt the user to make several calculation selections until the user enters 4, if the user wants to stop processing.
Display an error message if the user enters a number outside the range of 1 through 4 when selecting an item from the menu.
The program’s main is to contain only call statements. At least 3 sub-functions are required: one to calculate multiplication of numbers, one to determine the number of prime numbers, and one to sort numbers in ascending order. For each subfunction call at least two another subfunctions.
Output must be well presented.
What to do :
1. Date due for submission: 2 weeks time
2. Submit CD + report together with external documentation( Flowchart or pseudo code)
3. Report must be well presented
Additional information:
• Prompt user for input
• Comments should appear in the program to:
◦ Explain the purpose of the program
◦ Identify who wrote it
◦ Explain the purpose of particular statements
The program’s main is to contain only call statements. At least 3 sub-functions are required: one to calculate multiplication of numbers, one to determine the number of prime numbers, and one to sort numbers in ascending order. For each subfunction call at least two another subfunctions.
Hopefully, it should give you an idea on how to begin writing the program. If not, then you may want to reconsider changing your degree plan in school.
The "show table", "find primes", and "sort numbers" are independent tasks. They can be written independently. The "menu" in main is independent too. You can write most of it even if you don't have functions to call.
You did state that this is your "final assignment". Therefore, you should not have any excuse for "I don't know".
Your professor gave you some tasks that you should do, that have nothing to do with writing code. This is only the last step.
First:
2. Submit CD + report together with external documentation( Flowchart or pseudo code)
Break the problem down into smaller sets of problems.
Do some maths on paper, for instance how do you find prime numbers.
Second:
If you are able to work this out, try to find which data types your program may need.
Do you need double, float, integers, something else?
What else does your program need?
Arrays, vectors?
Do you need loops? Which ones?
What should be input?
What should be output?
Try to find possible functions.
Define what they should do.
Define which data type(s) they accept, if any.
Define whether any of the functions should return something.
In case of multiple functions, how should they interact?
Determine which function calls which.
Then, write pseudo-code, (or actual code), for the smaller problems you are condifent you can solve. In the end, when writing code, combine what works, and see if it works in conjunction with everything else in your actual program.
If you aren't able to do at least this, then you are likely to fail your course. (Unless you find someone who does all the work you should be doing. Again, you will fail, because you never learn problem solving skills, much less how to write a program on your own.)
The link below may help you on how could the output of the program look. It should give you hints on how to write the requirements that @Misenna was telling you about. https://youtu.be/T36Ph2rNTHM?t=1m
Why are you even taking this class? I remember last semester where you asked the community to do your whole assignment for you, which they did. I thought you would at least go ahead and try to learn something, but it seems that you have done the complete opposite. You always seem to put it off until the very last minute and then asking us to do it for you again. It seems you don't even grasp the basics of c++ let alone any sort of programming. I am assuming you are studying some kind of engineering at University. For what reason are you studying then? Just because you're handed a piece of paper doesn't mean you're an engineer. I think it's time to change majors. This isn't getting you anywhere in life.