Question

In: Computer Science

C++ program that runs on Visual Basic that computes the total cost of books you want...

C++ program that runs on Visual Basic that computes the total cost of books you want to order from an online bookstore. It does so by first asking how many books are in your shopping cart and then based on that number, it repeatedly asks you to enter the cost of each item. It then calls two functions: one for computing the taxes and another for computing the delivery charges. The function which computes delivery charges works as follows: It adds a 5% delivery charge for standard delivery if the total is below $1,000, and an additional 10% charge if you want an expedited next day delivery. The tax and delivery charges are added to the bill and the total cost is displayed.

Solutions

Expert Solution

I wrote the code in very basic manner you will easily understand it(#Edited)

#include <iostream>

using namespace std;
int Tax(int sum)
{
int tax;
tax=(sum*10)/100;
return tax;
}

int Next(int sum,int n)
{
int nextday;
if(n==1)
nextday=(sum*10)/100;
return nextday;
}

int deliveryCharge(int sum)
{
int delivery=0;
if(sum>1000)
{
delivery=sum*10/100;
}
if(sum<1000)
{
delivery=(sum*5)/100;
}
return delivery;
}

int main()
{
int cart_book,book_price,tax,delivery,nextDayCharge,n;
int sum=0,total;
cout << "How many books in your cart?" << endl;
cin>>cart_book;
cout<<"Do you want to pick the order tomorrow if Yes input 1 else if NO 0:";
cin>>n;
while(cart_book!=0)
{
cout<<"Tell me the price of book no:"<<cart_book<<endl;
cin>>book_price;
sum=sum+book_price;
cart_book--;
}

tax=Tax(sum);//calculate tax on product
delivery=deliveryCharge(sum);//calculate delivery charge
nextDayCharge=Next(sum,n);//next day delivery charge
total=sum+tax+delivery+nextDayCharge;//find out total amount to be paid after all purchase
cout<<"Total amount to be paid is"<<total;

return 0;
}


Related Solutions

In the space provided below write a C++ program that computes the total cost of books...
In the space provided below write a C++ program that computes the total cost of books you want to order from an online bookstore. It does so by first asking how many books are in your shopping cart and then based on that number, it repeatedly asks you to enter the cost of each item. It then calls two functions: one for computing the taxes and another for computing the delivery charges. The function which computes delivery charges works as...
In the space provided below write a C program that computes the total cost of items...
In the space provided below write a C program that computes the total cost of items you want to order online. It does so by first asking how many items are in your shopping cart and then based on that number, it repeatedly asks you to enter the cost of each item. It then adds a 5% delivery charge for standard delivery if the total is below $1,000, and an additional 10% charge if you want an expedited next day...
In the space provided below write a C ++ program that computes the total amount of...
In the space provided below write a C ++ program that computes the total amount of money you are depositing in your bank account. Your program does this by asking you to first enter the number and amount of each check you are depositing, and then it asks you to enter the type of cash bills being deposited and how many of each type, also the types of coins being deposited, and the number of each coin type.
Language: c++ using visual basic Write a program to open a text file that you created,...
Language: c++ using visual basic Write a program to open a text file that you created, read the file into arrays, sort the data by price (low to high), by box number (low to high), search for a price of a specific box number and create a reorder report. The reorder report should alert purchasing to order boxes whose inventory falls below 100. Sort the reorder report from high to low. Inventory data to input. Box number Number boxes in...
In the space provided below write a C program that computes the total amount of money...
In the space provided below write a C program that computes the total amount of money you have stored in your piggy bank. Your program does this by asking you for number of pennies, nickels, dimes, and quarters in the piggy bank and then displays how much money in total is in the piggy bank.
Use Visual Basic Language In this assignment you will need to create a program that will...
Use Visual Basic Language In this assignment you will need to create a program that will have both a “for statement” and an “if statement”. Your program will read 2 numbers from the input screen and it will determine which is the larger of the 2 numbers. It will do this 10 times. It will also keep track of both the largest and smallest numbers throughout the entire 10 times through the loop. An example of the program would be...
Write a C++ program that inputs a sequence of integers into a vector, computes the average,...
Write a C++ program that inputs a sequence of integers into a vector, computes the average, and then outputs the # of input values, the average, and the values themselves. There are 0 or more inputs values, followed by a negative value as the sentinel; the negative value is not stored and not counted. The following sample input: 10 20 0 99 -1 would produce the following output: N: 4 Avg: 32.25 10 20 0 99 The main program has...
Write a C++ program that inputs a sequence of integers into a vector, computes the average,...
Write a C++ program that inputs a sequence of integers into a vector, computes the average, and then outputs the # of input values, the average, and the values themselves. There are 0 or more inputs values, followed by a negative value as the sentinel; the negative value is not stored and not counted. The following sample input: 10 20 0 99 -1 would produce the following output: N: 4 Avg: 32.25 10 20 0 99 The main program has...
IN BASIC C# If It Fits, It Ships! OVERVIEW In this program you will be calculating...
IN BASIC C# If It Fits, It Ships! OVERVIEW In this program you will be calculating the total amount the user will owe to ship a rectangular package based on the dimensions and we will add in insurance based on the prices of the items inside of the package.. INSTRUCTIONS: 1. Welcome the user and explain the purpose of the program. 2. In the Main, prompt the user for the width, length and height of their package. a. Each of...
Description: To create a Visual Basic program that will obtain a sentence from the user, parse...
Description: To create a Visual Basic program that will obtain a sentence from the user, parse the sentence, and then display a sorted list of the words in the sentence with duplicate words removed. Tasks: Design a method (algorithm) to solve the above problem using pseudocode or a flowchart. Translate your algorithm into an appropriate VB program and test it using the following input sentence. "We are the world We are the children" Submit: Pseudocode version of algorithm/Flowchart version of...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT