The objective for this assignment is to make sure
You are familiar with repetitive structures (loops) and selection statements (if/else or switch) in any com- bination.
You can recover from wrong user
You are comfortable with console input and output involving numeric
You can approach a complex problem, break it down into various parts, and put together a
From this assignment, please make sure you conform to Output requirements. So far, we have allowed you to write your own output statements, print out intermediate steps, etc. You should now be familiar enough with cout statements and output formatting that you should be able to EXACTLY match the sample output (other than whitespace and floating point precision when it is not specified).
Turn in your 2 files coprimes.cpp and letters.cpp to Canvas.
2 Program 1 - CoPrime Numbers
SOP the great overlord of all things overlordy has a penchant for making whimsical decisions and seeks your help in enforcing those decisions. Sop has, in his infinite wisdom, decided that all under his purview will only count in coprime numbers. He will randomly yell out a number and you need to show him all the numbers that come before it, which are coprime to Sop’s number.
Write a C++ program to print all the coprime numbers below a certain given number. Coprime numbers are numbers that do not share any common factors besides 1. Make sure your program conforms to the following requirements:
This program should be called cpp
Accept the upper limit from the user (as an integer). (5 points)
Make sure the number is at least 2. If it is not, terminate the program. (5 points).
Go from 1 to the number. If you happen to find a number that is coprime, print it. (35 points)
Add comments wherever necessary. (5 points)
2.1 Sample Runs
There are 3 sample runs here. (It’s OK if you have an extra comma at the end)
Enter the number: 8
The coprime numbers are:
3, 5, 7
Enter the number: 25
The coprime numbers are:
2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24
Enter the number: -7
Number is too small. Goodbye.
3 Program 2 - Printing Letters
Sop is very impressed with your work. He has another task for you, upon completion of which he will reward you with more money than you can imagine (and you can imagine a lot) . He has decided that he likes labeling things that belong to him. However, he believes his time would be better spent in acquiring things to label, and decides to delegate the menial task of inscribing his name, to you. In the same vein, you decide to write a program to perform this repetitive task. Write a C++ program to print the letters S, O and P in ASCII art. Make sure your program conforms to the following requirements:
This program should be called cpp
Accept the size of the letter (in the number of lines) from the user. This number should be an odd number greater than or equal to 5. If the value entered is invalid, tell the user so, and ask for another one. Repeat until you get a valid (6 points)
Accept the letter to be printed from the user. If the letter is S, O or P, go to the next step. If not, tell the user that the letter is invalid, and ask for another Repeat until you get a valid letter. (6 points)
Print the letter in ASCII art form. The sample run gives examples for each letter. ( 30 points, 10 per letter)
Repeat the entire process if the user indicates they wish to continue. (4 points)
Make sure you add comments to explain the logic. (4 points)
3.1 Sample Run
Welcome to the letter printer. Enter the size : 3
Invalid size. Enter the size again: -4 Invalid size. Enter the size again: 7 Enter the letter: C
Invalid letter: Enter the letter again: # Invalid letter: Enter the letter again: O
Would you like to continue? (Y or N): Y Enter the size: 8
Invalid size. Enter the size again: 11 Enter the letter: P
Would you like to continue? (Y or N): Y Enter the size: 9
Enter the letter: S
Would you like to continue? (Y or N): N
Include the header comment with your name and other information on the top of your files
Please make sure you’re only using the concepts already discussed in class. Please restrict yourself to input/output statements, variables and operators, selection statements and loops. Using functions, arrays or anything more advanced will result in a loss of points
Each program is worth 50 points
If we have listed a specification and allocated point for it, you will lose points if that particular item is missing from your code, even if it is trivial
No global variables (variables outside of main() )
All input and output must be done with streams, using the library iostream
You may only use the iostream library (you do not need any others for these tasks)
Please make sure that youre conforming to specifications (program name, print statements, expectedinputs and outputs etc.). Not doing so will result in a loss of points
NO C style printing is permitted. (Aka, don’t use printf). Use cout if you need to print to the screen
When you write source code, it should be readable and well-documented (comments).
Make sure you either develop with or test with CLion (to be sure it reports no compile errors or warnings) before you submit the program
Testing your program thoroughly is a part of writing good We give you sample runs to make sure you match our output requirements and to get a general idea of how we would test your code. Matching your outputs for JUST the sample runs is not a guarantee of a 100. We have several extensive test cases.
Please make sure you’ve compiled and run your program before you turn it in. Compilation errors can be quite We take 5 points off per compiler error for the first 9 errors. The 10th compiler error will result in a grade of 0.
Only a file turned in through Canvas counts as a submission. A file on you computer, even if it hasn’t been edited after the deadline, does not count
The student is responsible for making sure they have turned in the right file(s). We will not accept any excuses about inadvertently modifying or deleting files, or turning in the wrong files
Program submissions should be done through the Canvas class page, under the assignments tab (if it’s not there yet I’ll create it soon.) Do not send program submissions through e-mail – e-mail attachments will not be accepted as valid submissions
The ONLY files you will submit via Canvas are cpp and damage.cpp
General Advice - always keep an untouched copy of your finished homework files in your These files will have a time-stamp which will show when they were last worked on and will serve as a backup in case you ever have legitimate problems with submitting files through blackboard. Do this for ALL programs.
DescriptionIn this final assignment, the students will demonstrate their ability to apply two majorconstructs of the C programming language – Fu
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of