Find Jobs
Hire Freelancers

Classes and Data Abstraction (Object Oriented Design)

$15-20 USD

Terminado
Publicado hace casi 22 años

$15-20 USD

Pagado a la entrega
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.
ID del proyecto: 2849441

Información sobre el proyecto

20 propuestas
Proyecto remoto
Activo hace 22 años

¿Buscas ganar dinero?

Beneficios de presentar ofertas en Freelancer

Fija tu plazo y presupuesto
Cobra por tu trabajo
Describe tu propuesta
Es gratis registrarse y presentar ofertas en los trabajos
Adjudicado a:
Avatar del usuario
See private message.
$10 USD en 14 días
2,2 (5 comentarios)
4,2
4,2
20 freelancers están ofertando un promedio de $12 USD por este trabajo
Avatar del usuario
See private message.
$17 USD en 14 días
5,0 (137 comentarios)
7,0
7,0
Avatar del usuario
See private message.
$12,75 USD en 14 días
4,9 (139 comentarios)
5,6
5,6
Avatar del usuario
See private message.
$15,30 USD en 14 días
4,4 (72 comentarios)
5,5
5,5
Avatar del usuario
See private message.
$12,75 USD en 14 días
4,6 (60 comentarios)
4,5
4,5
Avatar del usuario
See private message.
$8,50 USD en 14 días
4,9 (69 comentarios)
4,2
4,2
Avatar del usuario
See private message.
$17 USD en 14 días
4,9 (18 comentarios)
3,9
3,9
Avatar del usuario
See private message.
$8,50 USD en 14 días
4,2 (6 comentarios)
3,6
3,6
Avatar del usuario
See private message.
$14,45 USD en 14 días
4,7 (32 comentarios)
3,3
3,3
Avatar del usuario
See private message.
$17 USD en 14 días
5,0 (12 comentarios)
3,2
3,2
Avatar del usuario
See private message.
$8,50 USD en 14 días
4,5 (15 comentarios)
2,7
2,7
Avatar del usuario
See private message.
$17 USD en 14 días
5,0 (4 comentarios)
2,1
2,1
Avatar del usuario
See private message.
$17 USD en 14 días
4,4 (6 comentarios)
1,6
1,6
Avatar del usuario
See private message.
$6,80 USD en 14 días
4,0 (4 comentarios)
0,9
0,9
Avatar del usuario
See private message.
$14,45 USD en 14 días
0,0 (0 comentarios)
1,1
1,1
Avatar del usuario
See private message.
$8,50 USD en 14 días
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
See private message.
$17 USD en 14 días
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
See private message.
$4,25 USD en 14 días
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
See private message.
$17 USD en 14 días
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
See private message.
$3,40 USD en 14 días
0,0 (0 comentarios)
0,0
0,0

Sobre este cliente

Bandera de UNITED STATES
United States
4,6
8
Miembro desde abr 8, 2002

Verificación del cliente

¡Gracias! Te hemos enviado un enlace para reclamar tu crédito gratuito.
Algo salió mal al enviar tu correo electrónico. Por favor, intenta de nuevo.
Usuarios registrados Total de empleos publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Cargando visualización previa
Permiso concedido para Geolocalización.
Tu sesión de acceso ha expirado y has sido desconectado. Por favor, inica sesión nuevamente.