Display the total amount of money the machine earned

Assignment Help Computer Engineering
Reference no: EM132208449

Write a program in C(not C+) that simulates a soft drink machine. The program should use a structure that stores the following data:

Drink Name

Drink Cost

Number of Drinks in the Machine

The program should create an array of structures (maximum 20). The elements should be initialized by reading all data from a file called "drinks.txt".

The first line in the data file contains the number of drink records. See sample data below.

Each time a program runs, it should load the data from the file and enter into a loop that displays the list of drinks and their cost on the screen.

If the user selects a drink, he or she will next enter the amount of money that is to be inserted into the machine.

The program should display the amount of change that would be returned and subtract one from the number of drinks left in the machine. If the user selects a drink that has sold out, a message should be displayed.

The loop then repeats. When the user chooses to quit the program, it should display the total amount of money the machine earned and save all the data back into the input file "drinks.txt".

Next time the program is run, it will load the new data into the array.

Reference no: EM132208449

Questions Cloud

A program to implement two different searching techniques : Write a program in C++ to implement two different searching techniques: - Linear search - Binary search
Prompts you to enter a positive integer value or q to quit : Use "tail recursion" where a function calls itself as explained on page 356 to calculate the sum of all integers from 1 to the value entered.
How would mary proof negligence against chariot hotel : How would Mary proof negligence against Chariot Hotel if the cause of the severe breathing problem was the fact that Chariot Hotel staffs did not vacuum.
Allow the user to choose which lines to display on screen : Write a program in C that will Open a text file, Read the text file, and allow the user to choose which lines to display on the screen.
Display the total amount of money the machine earned : Display the total amount of money the machine earned and save all the data back into the input file "drinks.txt".
Define teh case for claiming the labor markets : In which case we can claim the labor markets in Athens and Thessaloniki (cities in Greece) in are separate from each other at least in the short run?
How immunizations affect the lymphatic system : Describe how immunizations affect the lymphatic system and how they affect the immune system. Describe differences between intracellular and extracellular fluid
Write a function that adds up the sum and returns it back : Write a program in C language that uses a struct and binary tree. Ask the student to enter their name and what they got on their midterm.
From which country to which country will the capital move : Assume Market A represents Egyptian Labor Market (at equilibriam w/p=9$), while Market B represent the Jordanian Labor Market (at equilibrium w/p =8$).

Reviews

Write a Review

Computer Engineering Questions & Answers

  Analyze household income survey data within cincinnati area

Create a project for a census bureau to obtain and analyze household income survey data within the Cincinnati area (including Northern Ky).

  Define physical network segmentation and microsegmentation

Explain the difference between physical network segmentation and microsegmentation as they relate to cloud security. Explain what it means to implement.

  How does an attack differ from a security risk

Pick two of these questions, restate each selected question, then in the next line, post your viewpoint/answer to it. Make sure you state your reasons.

  During the physical design phase of a database

Class, do the IT database designers require to understand data volumes and number of users of the database in order to create an effective physical design? Who needs to "predict" data volumes and number of users.

  How the company uses digital dashboards

List and describe (3) strategies for successful deployment of digital dashboards. Research Google, Amazon or Microsoft and explain (giving specific examples).

  What is the minimum number of states of a dfa

Let Ln be a collection of words over {0, 1} that begin with precisely n zeros. What is the minimum number of states of a DFA that recognizes Ln?

  Are there any cases in which these approaches yield the same

How is bipartite clustering (co-clustering) different from clustering the sets of objects and attributes separately?

  Discuss how these business rules could be set up

How can the above business rules be set up in a database and reinforced using DCL.

  Create a list of the stakeholders that should be considered

Reread the "Your Turn 1-2" box (Implementing a Satellite Data Network). Create a list of the stakeholders that should be considered in a stakeholder analysis of this project.

  How would you acquire the identifying information

How would you acquire the identifying information? List some items that would NOT be useful to identify the specific computer used by the insider.

  Define ethics and codes of conduct in a business environment

Describe the importance of ethics and codes of conduct in a business environment

  Describe the operation of the hcs12s timer output

For an HCS12 operating at a clock frequency of 96MHz and prescalar value set to 32, 20000 ticks of TCNT will cause how much delay (in msec)?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd