Westonci.ca is your trusted source for accurate answers to all your questions. Join our community and start learning today! Get immediate and reliable answers to your questions from a community of experienced experts on our platform. Connect with a community of professionals ready to provide precise solutions to your questions quickly and accurately.

Write a program to determine what change a cashier should return to a customer. The program will ask how much an item being purchased costs, and then how much the customer paid. The program will return what change should be given.

Enter the item cost: 7.12
Enter what customer paid: 20.00

The total number of cents to be returned is: 1288

Change given should be
Number of 10 dollar bills: 1
Number of 5 dollar bills: 0
Number of 1 dollar bills: 2
Number of quarters: 3
Number of dimes: 1
Number of nickels: 0
Number of pennies: 3

it needs to be in c++ not java

Sagot :

Using the knowledge in computational language in C++ it is possible to write a code that  determine what change a cashier should return to a customer.

Writting the code:

#include <iostream>

using namespace std;

int main() {

// your code goes here

cout << "Enter the item cost : ";

double cost;

cin >> cost;

cout << "\nEnter what customer paid : ";

double paid;

cin >> paid;

double ret;

ret = paid - cost;

cout << "\nThe total number of cents to be returned is : " << ret;

cout << "\nChange given should be";

int ten,five,one;

ten = ret/10;

ret = ret - (10*ten);

five = ret/5;

ret = ret - (5*five);

one = ret/1;

cout << "\nNumber of 10 dollar bills : " << ten;

cout << "\nNumber of 5 dollar bills : " << five;

cout << "\nNumber of 1 dollar bills : " << one;

return 0;

}

See more about C++ at brainly.com/question/12975450

#SPJ1

View image lhmarianateixeira
We appreciate your visit. Hopefully, the answers you found were beneficial. Don't hesitate to come back for more information. We hope you found what you were looking for. Feel free to revisit us for more answers and updated information. Discover more at Westonci.ca. Return for the latest expert answers and updates on various topics.