//C++ Code
/*
This application takes item name and price of that item and
store them
in parallel arrays, After getting input, It calculates subtotal of
items
, tax on subtotal and total. After calculating, It prints the final
report
to user
*/
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
/*Declare names constant MAX_SIZE and initialize it to
50*/
const int MAX_SIZE = 50;
/*Constant TAX_PERCENT and initialize it to
0.0825*/
const double TAX_PERCENT = 0.0825;
/*Declare an array called item that holds text index
to maximum
size and initialize it to empty*/
string item[MAX_SIZE] = { };
/*Declare an array called price that holds double
precision and initialized to 0*/
double price[MAX_SIZE] = { };
/*Declare variable subtotal,total and tax hat holds
double and initialize it to 0*/
double subtotal = 0, total = 0, tax = 0;
/*Declare variable no_of_item and index that holds
integer and initialize it to 0*/
int no_of_item = 0, index = 0;
/*Prompt user to get number of items*/
cout << "How many items whould you like to enter
(MAX =50)? ";
/*Get the value from keyboard and store it
no_of_item*/
cin >> no_of_item;
if (no_of_item == 0)
cout << "There are no items
in the list..." << endl;
else if (no_of_item < 0 || no_of_item>50)
cout << "Number of items has
to be between 0 and 50...\n";
else
{
for (index = 0; index <
no_of_item; index++)
{
cout <<
"Enter the "<< (index + 1)<< " item followed by the
price (Ex- Oreo 9.59): ";
cin >>
item[index] >> price[index];
}//end for
index = 0;
while (index < no_of_item)
{
subtotal +=
price[index];
index++;
}//End while
//Calculate tax
tax = subtotal * TAX_PERCENT;
//round the tax
tax = floor(tax*100+0.5)/100;
//Calculate total
total = subtotal + tax;
cout << "Below is your
receipt:\n";
//Format the output
cout << fixed <<
setprecision(2);
for (index = 0; index <
no_of_item; index++)
{
cout
<<"\t"<<left<< setw(10) <<
item[index]<<right << setw(10) << price[index]
<< endl;
}
cout << endl;
//Format output to left
justified
cout<<left<<setw(10)
<< "Subtotal: " << right << setw(10) <<
subtotal << endl;
cout << left <<
setw(10) << "Tax: " << right << setw(10) <<
tax << endl;
cout << left <<
setw(10) << "Total: " << right << setw(10)
<< total << endl;
}
return 0;
}
//Output

//If you need any help regarding this solution.... please leave a comment... thanks
:) Problem: ??? Your task: implement in CH the algorithm solution shown below. Then analyze it...
4.18 Ch 7 Program: Online shopping cart (continued) (C++) This program extends the earlier "Online shopping cart" program. (solution from previous lab assignment is provided in Canvas). (1) Extend the ItemToPurchase class per the following specifications: Parameterized constructor to assign item name, item description, item price, and item quantity (default values of 0). (1 pt) Public member functions SetDescription() mutator & GetDescription() accessor (2 pts) PrintItemCost() - Outputs the item name followed by the quantity, price, and subtotal PrintItemDescription() -...
8.7 LAB*: Program: Online shopping cart (Part 2)Note: Creating multiple Scanner objects for the same input stream yields unexpected behavior. Thus, good practice is to use a single Scanner object for reading input from System.in. That Scanner object can be passed as an argument to any methods that read input.This program extends the earlier "Online shopping cart" program. (Consider first saving your earlier program).(1) Extend the ItemToPurchase class per the following specifications:Private fieldsstring itemDescription - Initialized in default constructor to "none"Parameterized...
Zybooks 11.12 LAB*: Program: Online shopping cart (continued) Python 3 is the code needed and this is in Zybooks Existing Code # Type code for classes here class ItemToPurchase: def __init__(self, item_name="none", item_price=0, item_quantity=0): self.item_name = item_name self.item_price = item_price self.item_quantity = item_quantity # def __mul__(self): # print_item_cost = (self.item_quantity * self.item_price) # return '{} {} @ ${} = ${}' .format(self_item_name, self.item_quantity, self.item_price, print_item_cost) def print_item_cost(self): self.print_cost = (self.item_quantity * self.item_price) print(('{} {} @ ${} = ${}') .format(self.item_name, self.item_quantity, self.item_price,...
Ch 7 Program: Online shopping cart (continued) (Java)This program extends the earlier "Online shopping cart" program. (Consider first saving your earlier program).(1) Extend the ItemToPurchase class per the following specifications:Private fieldsstring itemDescription - Initialized in default constructor to "none"Parameterized constructor to assign item name, item description, item price, and item quantity (default values of 0). (1 pt)Public member methodssetDescription() mutator & getDescription() accessor (2 pts)printItemCost() - Outputs the item name followed by the quantity, price, and subtotalprintItemDescription() - Outputs the...
In this project you will write a C++ program that simulates the purchase of a single item in an online store. What to do Write a C++ program that: 1. Prints out a welcome message. 2. Prompts the user for the following information: (a) Their first name (example: Roger) (b) Their last name (example: Waters) (c) The name of the product (example: Brick) (d) The unit price of the product (example: 1.99) (e) The quantity to buy (example: 200) (f)...
Assume that a restaurant offers the following breakfast items: Plain Egg $1.45 Bacon and Egg $2.45 Muffin $0.99 French Toast $1.99 Fruit Basket $2.49 Cereal $0.69 Coffee $0.50 Tea $0.75 Write a program that stores the following data about each menu item in a structure called MenuItem: • A description of the menu item • The price of the menu item • A count of the number of times the item has been ordered The program should keep an array...
In C code 1. Write and submit the algorithm OR flowchart to indicate you understand the problem 2. Create a project and name the source code lastname_firstname_prog5.c 3. Use the prog5.c as a guide, copy/ paste into your project source code *** build run and test, the outline code - You will need to declare an integer variable called again and initialize it 4. Add the function prototype and implement the function definition for the Greeting function 5. Add the...
Python 3 Question: All I need is for someone to edit the program with comments that explains what the program is doing (for the entire program) def main(): developerInfo() #i left this part out retail = Retail_Item() test = Cash_Register() test.data(retail.get_item_number(), retail.get_description(), retail.get_unit_in_inventory(), retail.get_price()) answer = 'n' while answer == 'n' or answer == 'N': test.Menu() print() print() Number = int(input("Enter the menu number of the item " "you would like to purchase: ")) if Number == 8: test.show_items() else:...
Need three seperate files. ShoppingCartManager.java
ShoppingCart.java
ItemsToPurchase.java
These are from part 1
what do you mean by deep study
7.25 LAB*: Program: Online shopping cart (Part 2) Note: Creating multiple Scanner objects for the same input stream yields unexpected behavior. Thus, good practice is to use a single Scanner object for reading input from System.in. That Scanner object can be passed as an argument to any methods that read input This program extends the earlier Online shopping cart program (Consider...
C++
Retailltem.h, Retailltem.cpp, Store.h, Store.cpp, and Driver.cpp. Description: Write a set of programs that holds data about items in a retail store. Your submission should include 5 files, Retailltem.b, Retailltem.cpp, Store, Store.cpp, and Driver.cpp 1. Retailltem class: The class should have three member variables • description (a string, represent the item's name. A name contains space) quantity (an int, represent how many current available) price (a double, item's price) Member Functions Constructor with default argument get Description getQuantity getPrice setDescription...