Earn Higher Grades With Instant Assignment Help.Ask Question!

C++ Programming
(5/5)

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

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

1 Objective

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:

  1. This program should be called cpp

  2. Accept the upper limit from the user (as an integer). (5 points)

  3. Make sure the number is at least 2. If it is not, terminate the program. (5 points).

  4. Go from 1 to the number. If you happen to find a number that is coprime, print it. (35 points)

  5. 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:

  1. This program should be called cpp

  2. 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)

  3. 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)

  4. Print the letter in ASCII art form. The sample run gives examples for each letter. ( 30 points, 10 per letter)

  5. Repeat the entire process if the user indicates they wish to continue. (4 points)

  6. 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

General Requirements

  1. Include the header comment with your name and other information on the top of your files

  2. 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

  3. Each program is worth 50 points

  4. 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

  5. No global variables (variables outside of main() )

  6. All input and output must be done with streams, using the library iostream

  7. You may only use the iostream library (you do not need any others for these tasks)

  8. 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

  9. NO C style printing is permitted. (Aka, don’t use printf). Use cout if you need to print to the screen

  10. When you write source code, it should be readable and well-documented (comments).

  11. 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

  12. 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.

  13. 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.

  14. 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

  15. 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

  16. 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

  17. The ONLY files you will submit via Canvas are cpp and damage.cpp

  18. 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.

Attachments:
(5/5)

Related Questions

CSI 1420 Introduction to C Programming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two majorconstructs of the C programming language – Fu

The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

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. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

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

SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

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

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 Sea Ports. Here are the classes and their instance variables we wish to define:

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

Ask This Assignment To Be Done By Our ExpertsGet A+ Grade Solution Guaranteed

expert
joyComputer science
(4/5)
12 Answers Hire Me
expert
Robert DLaw
(4.8/5)
728 Answers Hire Me
expert
Dr Samuel BarberaStatistics
(5/5)
682 Answers Hire Me
expert
Tutor For YouEconomics
(5/5)
780 Answers Hire Me