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

  Create a decision tree and recommend the appropriate action

Explain the methodology utilized to create a decision tree and recommend the appropriate action to take based on your decision tree from criterion 5.

  Create a folder called raw data to store collected raw data

NIT6130 Introduction to Research Assignment - Experiment Design & Result Analysis. Create a folder called "raw data" to store the collected raw data

  Finish the function definition for interpret

Using two for loops call the function interpret on all the elements of linkedin and facebook.

  Establish separation of duties via role assignment

Setting security for each employee based on the specific role provides the tightest and most personalized security. The trade-off is increased amount of administration effort when setting up the specific roles to use and the access permitted for ea..

  Questionrequire to create a database for music these are

questionrequire to create a database for music. these are entities that i will use for music database with their own

  Create a score counter and a score page that pops up

I need help creating a score counter and a score page that pops up after the squirrel runs out of acorns or gets hit by a lion. It should say: Game Over.

  Write an open frameworks program to generate a random

Write an open frameworks program to generate a random each to walk. At step, toss a coin determine if you move right/left or up down.

  Write a java program that contains a method

The method opens the file specified in the method argument filename and then reads integers from it. This file can contain any number of integers.

  Write a class encapsulating a music store which inherits

Write a class encapsulating a music store, which inherits from Store. A music store ahs the following additional attributes: the number of titles it offers.

  Display the semantic errors in the compilation listing

Variables and parameter names have local scope. The scope rules require that all names be declared and prohibit duplicate names within the same scope

  Which requires the most processing power for audio encoding

Which requires the most processing power for audio encoding? Which addresses issues of copy protection, and how are these issues addressed?

  Write a method that returns the height of an AVL tree

Write a method that returns the height of an AVL tree by tracing only one path to a leaf, not by investigating all the nodes in the tree.

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