Find Jobs
Hire Freelancers

Classes and Data Abstraction (Object Oriented Design)

$15-20 USD

Completed
Posted almost 22 years ago

$15-20 USD

Paid on delivery
Classes and Data Abstraction (Object Oriented Design) Modify the following program so that the candy machine performs the following: 1. Continue asking the user to deposit enough money till it reaches the selling price (the current program asks the user twice to put additional money and if the user doesn't put enough, the machine stops asking him and take the money) 2. Return change if there is any. (The current program doesn't return any change) I will email the whole program to the winner. The main program: (partial) // Main program: #include #include "candy.h" using namespace std; void showSelection(); void sellProduct(dispenserType& item, cashRegister& pCounter); int main() { cashRegister counter; dispenserType candy(100,50); dispenserType chips(100,65); dispenserType gum(75, 45); dispenserType cookies(100,85); int choice; // variable to hold the selection showSelection(); cin>>choice; while(choice != 9) { switch(choice) { case 1: sellProduct(candy, counter); break; case 2: sellProduct(chips, counter); break; case 3: sellProduct(gum, counter); break; case 4: sellProduct(cookies, counter); break; default: cout<<"Bad Selection"<<endl; }//end switch showSelection(); cin>>choice; }//end while return 0; }//end main void showSelection() { cout<<"*** Welcome to Shelly's Candy Shop ***"<<endl; cout<<"To select an item, enter "<<endl; cout<<"1 for Candy"<<endl; cout<<"2 for Chips"<<endl; cout<<"3 for Gum"<<endl; cout<<"4 for Cookies"<<endl; cout<<"9 to exit"<<endl; }//end showSelection void sellProduct(dispenserType& item, cashRegister& pCounter) { int amount; // variable to hold the amount entered int amount2; // variable to hold extra amount needed if([login to view URL]() > 0) //if dispenser is not empty { cout<<"Please deposit "<<[login to view URL]() <<" cents"<<endl; cin>>amount; if(amount < [login to view URL]()) { cout<<"Please deposite another " <<[login to view URL]() - amount<<" cents"<<endl; cin>>amount2; amount = amount + amount2; } if(amount >= [login to view URL]()) { [login to view URL](amount); [login to view URL](); cout<<"Collect item at the bottom and enjoy"<<endl; } else cout<<"Not enough amount. Collect what you deposited."<<endl; cout<<"*-*-*-*-*-*-*-*-*-*-*-*-*-* ## Deliverables Fuull documentation for the modified part. Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. Complete copyrights to all work purchased. ## Platform The program must work on Visual C++ and be a Win32 Console Application and C++ header.
Project ID: 2849441

About the project

20 proposals
Remote project
Active 22 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
See private message.
$10 USD in 14 days
2.2 (5 reviews)
4.2
4.2
20 freelancers are bidding on average $12 USD for this job
User Avatar
See private message.
$17 USD in 14 days
5.0 (137 reviews)
7.0
7.0
User Avatar
See private message.
$12.75 USD in 14 days
4.9 (139 reviews)
5.6
5.6
User Avatar
See private message.
$15.30 USD in 14 days
4.4 (72 reviews)
5.5
5.5
User Avatar
See private message.
$12.75 USD in 14 days
4.6 (60 reviews)
4.5
4.5
User Avatar
See private message.
$8.50 USD in 14 days
4.9 (69 reviews)
4.2
4.2
User Avatar
See private message.
$17 USD in 14 days
4.9 (18 reviews)
3.9
3.9
User Avatar
See private message.
$8.50 USD in 14 days
4.2 (6 reviews)
3.6
3.6
User Avatar
See private message.
$14.45 USD in 14 days
4.7 (32 reviews)
3.3
3.3
User Avatar
See private message.
$17 USD in 14 days
5.0 (12 reviews)
3.2
3.2
User Avatar
See private message.
$8.50 USD in 14 days
4.5 (15 reviews)
2.7
2.7
User Avatar
See private message.
$17 USD in 14 days
5.0 (4 reviews)
2.1
2.1
User Avatar
See private message.
$17 USD in 14 days
4.4 (6 reviews)
1.6
1.6
User Avatar
See private message.
$6.80 USD in 14 days
4.0 (4 reviews)
0.9
0.9
User Avatar
See private message.
$14.45 USD in 14 days
0.0 (0 reviews)
1.1
1.1
User Avatar
See private message.
$8.50 USD in 14 days
0.0 (0 reviews)
0.0
0.0
User Avatar
See private message.
$17 USD in 14 days
0.0 (0 reviews)
0.0
0.0
User Avatar
See private message.
$4.25 USD in 14 days
0.0 (0 reviews)
0.0
0.0
User Avatar
See private message.
$17 USD in 14 days
0.0 (0 reviews)
0.0
0.0
User Avatar
See private message.
$3.40 USD in 14 days
0.0 (0 reviews)
0.0
0.0

About the client

Flag of UNITED STATES
United States
4.6
8
Member since Apr 8, 2002

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.