Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Exercise #1: Ascending Power Numbers The department of History has just bought a new photocopier. Any person using the photocopier must enter his/her type

image text in transcribedC++
Exercise #1: Ascending Power Numbers The department of History has just bought a new photocopier. Any person using the photocopier must enter his/her type and an identification code. You have been asked to do the following Write a program that determines whether identification codes typed by users of a photocopier are valid, and prints appropriate messages. If the identification code, which is a four-digit number, is correct your program computes the cost of copying according to the table below Your program should prompt the user for type, an identification code, and number of pages, read the information, and determine whether the code is valid or not. An identification code is valid if its rightmost digit is correct. A correct digit is equal to the remainder of the sum of the other three digits divided by 7. For example, a valid code that gives a correct digit is 7011 because (740+1) % 7 1. However, 9998 is not a valid code because (94949) % 7 6 8 Write a program that reads the person's type (S, s, T, t, C, c, O, or o), person's code, and the number of pages. The program checks if the code is correct it calculates and prints the cost, while if the code is not correct it prints the message "Invalid code" and stops Correct digits are assigned as follows:|Number of pages l to 10 11 l to 20120 Student (S):12 (means 1 or 2) Teacher (T): 3,4, 5 Secretary (C): 6 Others (O): 7, 8,9 Students Teachers . 10 Dhs 20% of 130 Dhs 30% of .20 Dhs 25% of 460 Dhs 10% of 0% of 0% of ries Others ee Sample input /output: nter the type, code, and number of pages: s 759e 21 Invalid code! nter the type, code, and number of pages: s 7691 21 cost is: 1.26 nter the type, code, and number of pages: c 3551 17 valid code! Enter the type, code, and number of pages : C 3556 17 The cost is: 2.55

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

More Books

Students also viewed these Databases questions

Question

Did the school meet Adequate Yearly Progress (AYP)?

Answered: 1 week ago