Question

In: Computer Science

Hello, this question relates to a class I am taking called introduction to C++. I have...

Hello, this question relates to a class I am taking called introduction to C++. I have no experience writing programs and outside of learning out of a textbook, and studying on my own, have little understanding of logic. I have been assigned a problem that requires me to write a program for a Grocery Bill, where the consumer inputs the price for 5 items, that the program calculates the total with a 6% sales tax. I really am not sure where to start for this exercise. Here is the assignment word for word:

"For this assignment, write a program that calculates a grocery bill. The program should output “Joe’s Market” as the title. The program should prompt the user to enter the price for five products of your choosing. The program should calculate the total price of the groceries, add 6% sales tax to the groceries, and display the total price including sales tax. Be sure to include comments throughout your code where appropriate."

Solutions

Expert Solution

Bill.cpp

#include<iostream>
using namespace std;
// main function
int main()
{
   // variables declaration
   double keyboard,mouse,monitor,hardDisk,panDrive,totalPrice,netPrice,tax;
   cout<<"*** Welcome To Joe's Market ***"<<endl<<endl;
   // accept prices for 5 product from user
   cout<<"Enter the price of Keyboard: ";
   cin>>keyboard;
   cout<<"Enter the price of Mouse: ";
   cin>>mouse;
   cout<<"Enter the price of Monitor: ";
   cin>>monitor;
   cout<<"Enter the price of Hard Disk: ";
   cin>>hardDisk;
   cout<<"Enter the price of Pan Drive: ";
   cin>>panDrive;
   // calculate total price of 5 products
   totalPrice=keyboard+monitor+mouse+panDrive+hardDisk;
   // calculate 6% sales tax
   tax=totalPrice*6/100;
   // calculate net total
   netPrice=totalPrice+tax;
   // print bill
   cout<<endl<<endl<<"**************************************"<<endl;
   cout<<"*** Joe's Market ***"<<endl;
   cout<<"**************************************"<<endl;
   cout<<"Keyboard: "<<keyboard<<endl;
   cout<<"Mouse: "<<mouse<<endl;
   cout<<"Monitor: "<<monitor<<endl;
   cout<<"Hard Disk: "<<hardDisk<<endl;
   cout<<"Pan Drive: "<<panDrive<<endl;
   cout<<"**************************************"<<endl;
   cout<<"Total: "<<totalPrice<<endl;
   cout<<"6% Sales Tax: "<<tax<<endl;
   cout<<"**************************************"<<endl;
   cout<<"Net Total: "<<netPrice<<endl;
   cout<<"**************************************"<<endl;
   return 0;
}

Output


Related Solutions

Hello, I am currently taking software design and analysis class and have a question about those...
Hello, I am currently taking software design and analysis class and have a question about those 3 in cpp, can you please help me? thank you - What is the complexity of pop()? push()? top()? size()? isEmpty()? - Write a C++ implementation of push() in a linked-chain implementation of stack - Write a C++ implementation of pop() in a linked-chain implementation of stack
hello i have question in c++ language Q1: create a class called RightTriangleShape, and it has...
hello i have question in c++ language Q1: create a class called RightTriangleShape, and it has data member called height which initialized to 3 by the constructor of the class. It has also the following function members: Void setHeight() to read, and set the height. Void getHeight() to print the value of height. void leftBottom_RTraingle(), prints shape a void leftTop_RTraingle(), prints shape b. void RightTop_RTraingle(), prints shape c. void RigtBottom_RTraingle(), prints shape d. The functions from 3 to 6 have...
Hi, I am taking stats class and I have one question. I have been struggling with...
Hi, I am taking stats class and I have one question. I have been struggling with it for few hours. To investigate the fluid mechanics of swimming, twenty swimmers each swam a specified distance in a water-filled pool and in a pool where the water was thickened with food grade guar gum to create a syrup-like consistency. Velocity, in meters per second, was recorded and the results are given in a table below. The researchers concluded that swimming in guar...
Hello, I have this question that I have been trying to solve for days. I am...
Hello, I have this question that I have been trying to solve for days. I am always able to solve the first part of the question, but I am never able to get the second part. Please help me understand how to set up this problem so I am able to solve it! Q: Let's revisit the banked curves from earlier to see another reason they are useful.We are building a road, and at one place we need to make...
I have a question about C++ programming Language class. I am confused with these terms and...
I have a question about C++ programming Language class. I am confused with these terms and what they are for. 1. Unix 2. Terminal 3. Git 4. CLOC 5. Linux Please explain each words and what's their jobs for C++. Also, if you know some good sources/websites, could you please provide me a link where I can learn how to use Unix, Terminal, Git, etc.
Hello, I have been trying to answer this question for the last hour and I am...
Hello, I have been trying to answer this question for the last hour and I am still struggling could someone help me? The deadline is in 1hour! Perform an analysis of variance on the following data set. Do this by answering the questions below. Group 1 Group 2 Group 3 82 87 97 91 90 99 93 91 104 94 99 105 94 101 106 95 115 109 99 118 110 101 114 103 117 105 121 106 121 106...
Hi, I am taking MGMT460 and I have a question on an assignment for Work rules...
Hi, I am taking MGMT460 and I have a question on an assignment for Work rules ch.6 : What style of leadership is encouraged at Google (phrase your answer in one of the four styles described in Organizational Design, pages 160 – 166)? Explain (provide at least 3 examples from Work Rules, chapter 6).
Hello. I have a question related to astrology please: Because I am a little bit believe...
Hello. I have a question related to astrology please: Because I am a little bit believe in astrology and use different kind of app like Astrotalk or Yodha Pro that astrologers predicted based on birthday, time of birth, place of birth, city of birth and all of app people predicts with only the same results that made me believe. But my question is : if all of them just base on those information about my birth, time, place, does it...
I am taking a Data Structures and Program Design class. BUT, I am having trouble getting...
I am taking a Data Structures and Program Design class. BUT, I am having trouble getting access to the vectors so that I can compare the guesses with the random numbers. I’ve been working on this for several days and don't feel any closer to a solution and could really use some help as I really don't know how to get this to work. Thank you! The assignment is: Design an ADT for a one-person guessing game that chooses 4...
Hello, I am just having a hard time understanding this question. The question is below. I...
Hello, I am just having a hard time understanding this question. The question is below. I am not supposed to write a program but instead in regular english sentence form just name the methods, fields, and variables I would use for this loan class. Im not really sure what a loan class means as well, thank you for your help. USING JAVA Given a Loan class, name the necessary fields and methods that we would need in this class. Be...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT