How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask ATLProg Your Own Question

ATLProg
ATLProg, Software Engineer
Category: Homework
Satisfied Customers: 8692
Experience:  Expert in Java C++ C C# VB Javascript Design SQL HTML
44910485
Type Your Homework Question Here...
ATLProg is online now
A new question is answered every 9 seconds

Drink Machine SimulatorWrite a program that simulates a

Customer Question

Drink Machine Simulator

Write a program that simulates a soft drink machine. The program should use a structure that stores the following data: Drink Name, Drink Cost and Number of drinks in Machine
The program should create an array of five structures. The elements should be initialized with the following data:
Drink Name Cost Number in Machine
Coca-Cola .75 20
Root Beer .75 20
Sprite .75 20
Spring Water .80 20
Apple Juice .80 20

Please create and use a input file. Each time the program runs, it should read the data from the input file and then enter a loop that performs the following steps: A list of drinks is displayed on the screen. The user should be allowed to either quit the program or pick a drink. If the user selects a drink, he or she will next enter the amount of money that is to be inserted into the drink machine. The program should display the amount of change that would be returned and subtract one from the number of that drink left in the machine. If the user selects a drink that has sold out(note-select Root Beer, since we start with 0 in the machine), 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 a current inventory list(i.e. What is left in the machine).
Input validation: Only accept positive values for the amount of money. Also, do not accept values greater than 1.00.
-Have project description, function headers, and inline comments



Optional Information:
Programming Language: c++
Submitted: 1 year ago.
Category: Homework
Expert:  ATLProg replied 1 year ago.
Hello Welcome. Thank you for your question, I’m ATLProg and I’ll try to help you.
Customer: replied 1 year ago.


Thank you. You wrote the program before for a student, and I cannot firgure it out.

Expert:  ATLProg replied 1 year ago.
By when you need this done Efrain
Customer: replied 1 year ago.

Tomorrow please. I am going to have to review it so I can learn it as well because I will be tested on it.

Expert:  ATLProg replied 1 year ago.
ok, stay here..
Customer: replied 1 year ago.

Awesome, thank you.

Expert:  ATLProg replied 1 year ago.
Which was the previous question link where you saw this answered ?
Expert:  ATLProg replied 1 year ago.
THIS ANSWER IS LOCKED!
You can view this answer by clicking here to Register or Login and paying $3.
If you've already paid for this answer, simply Login.
ATLProg, Software Engineer
Category: Homework
Satisfied Customers: 8692
Experience: Expert in Java C++ C C# VB Javascript Design SQL HTML
ATLProg and 6 other Homework Specialists are ready to help you
Expert:  ATLProg replied 1 year ago.
Have you been able to review the answer ? Can I assist you with anything with regards XXXXX XXXXX question ?
Customer: replied 1 year ago.


Are you going to be available Tuesday at 6pm? I will have another program that I will need help with, and only have an hour to complete.

Expert:  ATLProg replied 1 year ago.
Can we do like 8 pm EST tuesday ?
Customer: replied 1 year ago.


The test is from 6-715pm. That is the window that I log in for it.

Expert:  ATLProg replied 1 year ago.
Can we start at 7 PM EST then ? and how much time will we have ?
Customer: replied 1 year ago.


The window for the assignment is 6pm to 730pm EST

Expert:  ATLProg replied 1 year ago.
ok, I will try to be present..
Customer: replied 1 year ago.

I was checking to see if you would be available today at 6pm still? Since it is more urgent and we are on a time restraint, I will pay you 75 for this.

Expert:  ATLProg replied 1 year ago.
Yes , Sorry this particular requirement has just been a pain and I have been tryign to do all kinds of things !
Customer: replied 1 year ago.

I understand, I was very pleased with your work, so I just wanted to make sure you were available, otherwise I would ask someone else. I will send you the task once it is open, and I will have til 715 to complete it.

Expert:  ATLProg replied 1 year ago.
Before you open can you check with me that I am online...like 15 mins back ?
Customer: replied 1 year ago.

Will do.

Expert:  ATLProg replied 1 year ago.
Thanks
Customer: replied 1 year ago.

I am about to drive over to the testing site, was checking to see if you were online or would be online. I wont be able to open a computer til 6pm on the nose

Customer: replied 1 year ago.

I need help with a new problem:

#include <cstdlib> #include <iostream> // include the header needed for formatting output using namespace std; // Global constants // Note: feel free to lower the # XXXXX programing exercises/quizzes for // testing purposes. const int MAX_NAME_SIZE = 25; // first and last name size const int NUM_PROG_EX = 9; // number of programming exercises const int NUM_QUIZZES = 9; // number of quizzes // Structure to hold StudentInfo struct StudentInfo { int studentID; // to hold student ID char name[MAX_NAME_SIZE]; // to hold first and last name int progExercises[NUM_PROG_EX];// to hold all programming exercise scores int quizzes[NUM_QUIZZES]; // to hold all quizz scores int midTerm; // mid term exam score int final; // final exam score }; // function prototypes void getStudentInfo(StudentInfo [], int ); void displayStudentInfo(StudentInfo [], int ); int findMinIndex(const int [], int ); double getAVG(const int [], int , int ); double calculateFinalScore(double , double , int , int ); char assignLetterGrade (int ); void displayReport(int , char [], double , char ); void clearKBD(); int main(int argc, char *argv[]) { const int NUM_STUDENTS = 3; // number of students in the class // Note: feel free to lower the number of students for testing purposes. // For example NUM_STUDENTS = 1 to test just for youself // declare an array of students in the next line // call the function that will populate students array with data // calculated values int minIndexPE; // index of the lowest prog. exercises score int minIndexQuizzes; // index of the lowest quiz score double avgPE; // prog. exercise average without the lowest score double avgQuizzes; // quiz average score without the lowest score double finalScore; // final grade (numeric) char letterGrade; // A, B, C, D, F for (int i=0; i<NUM_STUDENTS; i++) { // call the function to get the index of the lowest prog. exercise // score. store the return value from the function call into minIndexPE // variable minIndexPE = ??? // call the function to get the index of the lowest quiz score. Store // the return value in minIndexQuizzes variable minIndexQuizzes = ??? // call the function to compute the the average prog exercise score // without the lowest score. store the return value in the avgPE // variable avgPE = ??? // call the function to compute the the average quiz score // without the lowest score. Store the return value onto avgQuizzes // variable avgQuizzes = ??? // call the function to calculate the final (numeric) grade // store the result of the function call in variable finalScore finalScore = ??? // call the function to assign the letter grade based on the final // score. Store the result of the function call in variable letterGrade // Note: you may need to convert the final score (a double) to an int // for this call! letterGrade = ??? // call the displayReport function with the above calculated // variables as arguments. You may need to supply some other // arguments as well. } system("PAUSE"); return EXIT_SUCCESS; } //***************************************************************************** // Function : displayReport // Peturns : void // Parameters : sID (input) - studentID for the current student // sName (input) - student name // finalScore (input) - calculated numberica final score // finalGrade (input) - assigned letter grade // Description : This function displays student record nicely formatted //***************************************************************************** void displayReport(int sID, char sName[], double finalScore, char finalGrade) { // display StudentID, StudentName, FinalScore (numeric), letterGrade } //***************************************************************************** // Function : calculateFinalScore // Peturns : double // Parameters : progExAVG (input) - average of all programming exercises // not including the lowest score // quizAVG (input) - average of all quizzes not including the // lowest score // midTerm (input) - mid term exam score // finalExam (input) - final exam score // Description : This function calculates the final grade (numeric) according to // the following formula: // finalGrade = (progExercisesAvg * 0.75) + // (quizAvg * 0.10) + // (midTerm * 0.05) + // (finalExam * 0.10) //***************************************************************************** double calculateFinalScore(double progExAVG, double quizAVG, int midTermExam, int finalExam) { // calculate and return the final (numeric) score } //***************************************************************************** // Function : findMinIndex // Peturns : int // Parameters : myArray (input) - array with all programming exercise scores // size (input) - the size of the array // Description : This function returns the index of the lowest element in the // myArray. //***************************************************************************** int findMinIndex(const int myArray[], int size) { // find the minimum value in the array and return its index } //***************************************************************************** // Function : getAVG // Peturns : double // Parameters : myArray (input) - array with all programming exercise scores // size (input) - the size of the array // minIndex (input) - index of the lowest score // Description : This function calculates the average of the values in the // myArray by skipping over (not taking into consideration) the // lowest value in the array. The minIndex parameter refers to // the lowest array value. The function then returns the average. //***************************************************************************** double getAVG(const int myArray[], int size, int minIndex) { // calculate the average, but be sure to exclude the value referenced // by the minIndex. // return the calculate average } //***************************************************************************** // Function : assignLetterGrade // Peturns : char // Parameters : finalScore(input) - final score // Description : This function calculates a letter grade for the final (numeric) // score based on the following scale: // 90-100 A // 80-89 B // 70-79 C // 60-69 D // 0-59 F // The function then returns the letter grade. //***************************************************************************** char assignLetterGrade (int finalScore) { // code to assign letter grade based on the scale (see the description // above). // return the assigned letter grade } //***************************************************************************** // Function : getStudentInfo // Peturns : void // Parameters : myStudents(input/output) - an array of StudentInfo structs // size (input) - the size of the array // Description : This function prompts the user for student information and // stores obtained information into student array. //***************************************************************************** void getStudentInfo(StudentInfo myStudents[], int size) { for (int i=0; i<size; i++) { // get the student ID // store the studentID in the appropriate field in current student // structure // clear the keyboard buffer clearKBD(); // get the student name // store the studentName in appropriate field in current student // structure // get student's programming exercise scores (all of them) // You may need to use clearKBD // store them accordingly. // get student's quiz scores (all of them) // You may need to use clearKBD // store them accordingly // get the mid-term // store the mid-term grade in appropriate field in current student // structure // get the final exam grade // store the final exam grade in appropriate field in current student // structure } // end of for loop } //***************************************************************************** // Function : clearKBD // Peturns : void // Parameters : none // Description : This is a helper function used to clear the keyboard buffer. //***************************************************************************** void clearKBD() { cin.clear(); cin.sync(); }

Expert:  ATLProg replied 1 year ago.
Sorry I was out...
Customer: replied 1 year ago.

I need help with a new problem, but I didnt know how to request you

Expert:  ATLProg replied 1 year ago.
I see other expert had posted on new question.can you request him to opt out and let him know you want to work with me if thats the case
Customer: replied 1 year ago.

How do i do that? I would prefer working with you since I have worked with you before

Customer: replied 1 year ago.

I guess he already started working on it. How do I know when you are online for the future? I am going to need 4 more programs. I honestly dont know how you guys do it, I dont get it. I am an IT major with a focus on Network security

Expert:  ATLProg replied 1 year ago.
Just start question with for atlprog

JustAnswer in the News:

 
 
 
Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.
 
 
 

What Customers are Saying:

 
 
 
  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
< Last | Next >
  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
  • This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!! Alex Los Angeles, CA
  • Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult. GP Hesperia, CA
  • I couldn't be more satisfied! This is the site I will always come to when I need a second opinion. Justin Kernersville, NC
  • Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around. Esther Woodstock, NY
  • Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know. Robin Elkton, Maryland
  • He answered my question promptly and gave me accurate, detailed information. If all of your experts are half as good, you have a great thing going here. Diane Dallas, TX
 
 
 

Meet The Experts:

 
 
 
  • Manal Elkhoshkhany

    Tutor

    Satisfied Customers:

    4522
    More than 5000 online tutoring sessions.
< Last | Next >
  • http://ww2.justanswer.com/uploads/BU/BusinessTutor/2012-2-2_115741_Kouki2.64x64.jpg Manal Elkhoshkhany's Avatar

    Manal Elkhoshkhany

    Tutor

    Satisfied Customers:

    4522
    More than 5000 online tutoring sessions.
  • http://ww2.justanswer.com/uploads/ComputersGuru/2010-02-13_051118_Photo41.JPG LogicPro's Avatar

    LogicPro

    Engineer

    Satisfied Customers:

    3458
    Expert in Java C++ C C# VB Javascript Design SQL HTML
  • http://ww2.justanswer.com/uploads/LI/lindaus/2012-6-10_04811_IMG20120609164157.64x64.jpg Linda_us's Avatar

    Linda_us

    Finance, Accounts & Homework Tutor

    Satisfied Customers:

    3124
    Post Graduate Diploma in Management (MBA)
  • http://ww2.justanswer.com/uploads/chooser77/2009-08-18_162025_Chris.jpg Chris M.'s Avatar

    Chris M.

    M.S.W. Social Work

    Satisfied Customers:

    2385
    Master's Degree, strong math and writing skills, experience in one-on-one tutoring (college English)
  • http://ww2.justanswer.com/uploads/JawaadAhmed/2009-6-27_12137_SIs_SHadi.jpg F. Naz's Avatar

    F. Naz

    Chartered Accountant

    Satisfied Customers:

    1988
    Experience with chartered accountancy
  • http://ww2.justanswer.com/uploads/JK/jkcpa/2011-1-16_182614_jkcpa.64x64.jpg Bizhelp's Avatar

    Bizhelp

    CPA

    Satisfied Customers:

    1876
    Bachelors Degree and CPA with Accounting work experience
  • http://ww2.justanswer.com/uploads/avremote/photoa.jpg Seanna's Avatar

    Seanna

    Tutor

    Satisfied Customers:

    1781
    3,000+ satisfied customers, all topics, A+ work
 
 
 

Related Homework Questions