Question: WRITE A C++ PROGRAM ------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------ 1. Count cash: Write a program that reads the amount of coins collected at the end of each day

WRITE A C++ PROGRAM

WRITE A C++ PROGRAM ------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------ 1. Count cash: Write a program

------------------------------------------------------------------------------------------------------

that reads the amount of coins collected at the end of each

------------------------------------------------------------------------------------------------------

day of a month in a local supermarket and calculates the total

1. Count cash: Write a program that reads the amount of coins collected at the end of each day of a month in a local supermarket and calculates the total amount in fils (1 AED = 100 fils). The program reads the data for the entire month from the file coins.txt (assume the month has 30 days). The input file has one line for each day where each line has: number of fils, space, number of 5-fils, space, number of 10-fils, space, number of 25-fils, space, and number of so-fils. Make sure that the total amount is displayed with exactly two decimals. For the sake of testing your program consider an input file where the first 29 lines, each contains 00000 and the last line are 11111. This means the file is for a month where no coins where collected in the first 29 days. The output should be 0.91 AED. Now if you test your program for having 0 0 0 0 0 for the first 28 days and for the last 2 days, we have: 77 117 430 705 520 89 320 414 833 850 Then the answer is shown below: Sample run (with the above file): Total amount collected is: AED 1178.32 execution time: 0.263 s Process returned @ (@xe) Press any key to continue. 2. Data Security Encryption is an effective way to achieve data security. To read an encrypted file, you must have access to a secret key or password that enables you to decrypt it. You are expected to implement a simple encryption/decryption program. The program shall read the text from an input text file character by character (use ein.get() function) and produces an encrypted or decrypted version of the file. Your program shall allow the user to enter either 1 for encryption or 2 for decryption. The encryption procedure is to replace each alphabet by another one and each digit by another digit as follows: character Encrypted character A,B,C......X,Y,Z T, U, V,.., Q, R, S Compute the shift from 'A' to 'T, 'a' a, b, c,........ n, o, p,...,k,l,m to 'n', and 'O' to 's'. Use the % operator to rotate. 0,1,2,........9 5,6,7...,3,4 Hint Other characters are not encrypted. The decryption procedure is to reverse the encryption procedure such that you obtain the original text file. Sample run: Enter your option: 1. to Encrypt the file 2. to Decrypt the file Option : 1 The encryption result of the input file is stored in "enrypted_msg.txt execution time : 2.634 s Process returned @ (@xe) Press any key to continue. Input file: (available on BB) Sample 1 decrypted_msg.bct -- File Edit Format View Help ABCDEFGHIJKLMNOPORSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789 Sample 2 decrypted magtet - Notepad File Edit Format Vew Help His Highness Dr Shaikh Sultan Bin Mohammad Al Qasini, Supreme Council Member and Ruler of Sharjah, attended the opening of the International Conference on Solutions for a better life at the University of Sharjah. The five-day International Conference is being hosted by the University of Sharjah in partnership with west virginia State University of the United States and the world Health Organisation (WHO). Windo In 1.C 100% Windows Of in 1. Coll 0% Output file: (encrypted_msg.txt; this is the input for decrypt process) Sample 1 Sample 2 errypted_msg.be - Notepad D enrypted_msg.txt. N. File Edit Format View Help vf Atuarff we Lunvxu thyena Uva Funzzng Ty Infvzv, File Edit Format View Help Lhcerzr Vbhapvy Frzore naq Khyre bs Lunewnu, TUVWXYZABCDEFGHIJKLMNOPQRS neeragra gur bcravat bs gur Bagreang bany Vbasrerapr nopqrstuvwxyzabcdefghijklm ba Lbyhgvbaf sbe n Urggre Ever ng gur Navirefugl bs Lunewu.Mur svir-nl Bagreang bany Vbasrerar vf 5678901234 orvat ubfgrq ol gur Navirefugl bs Lunewnu va chegarefuve jugu Prfg ovetvavn Lener Navirefvel bs gur Navgrq Lgngrf naq gur Peyq Arnygu Het avfngvba (PAH). Windo Ln 1.C 100% Windows (CF Ln 1, Col1 100% 3. Water Usage Write a program that asks the user to input the total number of available gallons of water (integer). In a loop input the number of gallons you want to use and display the remaining gallons of water. Repeat until the number of gallons as long as there are available gallons of water. At the end, display the number of days taken to finish the gallons of water. Sample run: Enter total available water in gallons: 35 How many gallons do you want to use: 13 The remaining gallons of water - 22 How many gallons do you want to use: 8 The remaining gallons of water = 14 How many gallons do you want to use: 11 The remaining gallons of water = 3 How many gallons do you want to use: 7 Sorry you can only use 3 gallons The remaining gallons of water - water is finished after 4 days

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!