www.vustudents.ning.com

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

# CS201 Assignment#01 Complete Solution Fall 2011

CS201 Assignment#01 Complete Solution Fall 2011

Views: 1577

Attachments:

### Replies to This Discussion

CS201 Assignment 1 Solution Fall 2011

#include <cstdlib>

#include <iostream>

using namespace std;

int main(int argc, char *argv[])

{

cout"***Virtual Resturent***\n\n";

int price;

cout "Enter the price of the meal:";

cin >> price;

float saleTax;

if(price<=100)

{

saleTax = 0.0 * price;

}

else if(price <= 200)

{

saleTax = 0.1 * price;

}

else

{

saleTax = 0.2 * price;

cout"\nPrice of Meal:\t"price;

cout"\nSales Tax:\t"saleTax;

cout"\n.....................";

float totalAmount;

totalAmount = price + saleTax;

cout "\nTotal Amount\t" totalAmount;

if (totalAmount<1000)

{

cout"\n\nThis customer should be served with Candies";

}

else if(totalAmount>=1000&&totalAmount<2000)

{

cout"\n\nThis customer should be served with SweetBread";

}

else if(totalAmount>=2000&&totalAmount<3000)

{

cout"\n\nThis customer should be served with Pudding";

}

else if(totalAmount>=3000&&totalAmount<4000)

{

cout"\n\nThis customer should be served with Cake";

}

else

{

cout"\n\nThis customer should be served with Trifle";

}

cout"\n\nDo you want to process another customer?";

char letter;

cout"\n\nEnter 'Y' for Yes or 'N' to exit>:";

cin>>letter;

switch(letter)

system("PAUSE");

return EXIT_SUCCESS;

}

tariq bhai last me jo grand total kerna hai us ka code kya ho ga...............

tariq bhai tell us which method is truly sure?

it is not complete solution i add this code and ask you to how i add switch statement yes or no and how repeat it for second customer and how calculate grand total ok ..............this is not compelet solution ok...........

you better not upload incomplete solutions that might confuse the students ..... but still thanks for helping other students with half solution :)

CS201 Assignment Idea Solution not 100% sure

#include <cstdlib>
#include <iostream>

using namespace std;

float calculateTax(float);
int calculateTotalBill(float,float);
void prize(int prize);
float dev,TotalTax,cal;
double GrandTotal=0;
int RecordCount=1;
int main()
{
coutright"Virtual Resturant"endl;
int Price;

char choice;

LoopHere:
cout"Enter the Price of meal:"endl;
cin>>Price;

int(calculateTotalBill(Price,calculateTax(Price)));
cout"\n\nThis customer should be served with candies"endl;
cout"\n\nDo you want process any other custom?"endl;
cout"Enter 'Y' to countinue or'N' to Exit>: y"endl;
cin>>choice;
if((choice =='Y') || (choice=='Y'))
{
++RecordCount;
goto LoopHere;
}
else if((choice =='N') || (choice=='N'))
{
cout"Totel Enteries were found: "RecordCountendl;
cout"Grand Total is: "GrandTotalendl;
system("pause");
}
else
{
cout"plese Enter the Input"endl;
}
return 0;
}
float calculateTax(float P)
{
if((P>1000)&&(P<=2000))
{
dev=1.0;
TotalTax=(dev/100)*P;
}
else if(P>2000)
{
dev=2.0;
TotalTax=(dev/100)*P;
}
else
{
TotalTax=0.0*P;
}
}
int calculateTotalBill(float Amount,float TaxPayable)
{
cout"Price of the meal:""\t"Amountendl;
cout"Payable Tax is:""\t"TaxPayableendl;
cout"...................."endl;
cout"Total Amount:""\t\t"Amount+TaxPayableendl;
GrandTotal+=Amount+TaxPayable;
}
void Prize(int prize)
{
if(prize<1000)
{
cout"This GAHAAK should be served with with Condies"endl;
}
else if((prize>=1000)&&(prize<2000))
{
cout"This GAHAAK should be served with with Sweet Bread"endl;
}
else if((prize>=2000)&&(prize<3000))
{
cout"This GAHAAK should be served with with Pudding"endl;

else if((prize>=3000)&&(prize<4000))
{
cout"This GAHAAK should be served with with Cake"endl;
}
}

thankx ..

#include <iostream.h>
void f(int);
int main ()
{
int mealprice;
int i, userinput[10];
int salestax;
int totalamounts;
int totalamount[10];
int totalamountofbill=0;
i=0;
char c;
cout endl "*** Virtual Restaurant ***" endl;
cout endl;
cout "Enter the price of meal: ";
for(i=0;i<10;i++)
{
if (totalamounts=mealprice+salestax)
{
totalamount[i]=totalamounts;
userinput[i]=totalamount[i];
for(i=0;i<10;i++)
{
if(totalamounts!=-1)
{
totalamount[i]=totalamounts;
}
totalamountofbill=totalamountofbill+totalamounts;
totalamounts=totalamounts++;
}
do

cin >> mealprice;
if(mealprice!=-1)
{
userinput[i]=mealprice;
}i++;
}while(mealprice!=-1 && i<10);
if(mealprice<=1000)
{
salestax=(mealprice*0/100);
totalamounts=mealprice+salestax;
}
if(mealprice>1000&&mealprice<=2000)
{
salestax=mealprice*1/100;
totalamounts=mealprice+salestax;
}
if(mealprice>2000)
{
salestax=mealprice*2/100;
totalamounts=mealprice+salestax;
}
cout "Meal Price: " mealprice '\n';
cout "Sales Tax: " salestax '\n';
cout "------------------------------"'\n';
cout "Total Amount: " totalamounts'\n';
if(totalamounts<1000)
{
cout "This customer should be served with Candies"'\n';
}
if(totalamounts>=1000 && totalamounts<2000)
{
cout "This customer should be served with Sweet Bread"'\n';
}
if(totalamounts>=2000 && totalamounts<3000)
{
cout "This customer should be served with Puding"'\n';
}
if(totalamounts>=3000 && totalamounts<4000)
{
cout "This customer should be served with Cake"'\n';
}
if(totalamounts>4000)
{
cout "This customer should be served with Trifle"'\n';
}
cout "Do you want to enter the other customer?" endl;
cout "Press 'Y' to continue or 'N' to Exit: ";
do
{

cin >> c;
if (c=='y'||c=='Y')

main();
int i=0;
}
if (c=='n'||c=='N')
{
cout "Grand Total: " '\n';
cout '\n';
cout "Total Customers: " i-1 '\n';
cout "Total Amount of Bills: " totalamountofbill '\n';
return 1;
}
}while(c!='n'||c!='N');
}
}
return 0;
}

it contain errors :(

#include<iostream.h>
#include<conio.h>
main()
{
int price;
float tax,t_amnt;
char choice;
double g_total;
cout"***VIRTUAL RESTURENT***"endlendl;
start:
cout"\nEnter the price of meal : ";
cin>>price;
if(price>=2000)
tax=price*0.02;
else if (price>=1000)
tax=price*0.01;
else
tax=0.0000;
t_amnt=price+tax;
g_total+=t_amnt;
cout"Price of the Meal :"priceendl;
cout"Sales Tax :\t "taxendl;
cout"-------------------------"endl;
cout"Total Amount : \t "t_amntendl;
if(price>=4000)
cout"\nThis Customer shouled be served with Trifle"endl;
else if(price>=3000)
cout"\nThis Customer shouled be served with Cake"endl;
else if(price>=2000)
cout"\nThis Customer shouled be served with Pudding"endl;
else if(price>=1000)
cout"\nThis Customer shouled be served with Sweet Bread"endl;
else
cout"\nThis Customer shouled be served with Sweet Candies"endl;
cout"\nDo you want to Processe anonter Customer ?"endl;
cout"\nEnter 'Y' for Yes or 'N' for Exit >:";
cin>>choice;
if(choice=='Y'||choice=='y')
{
goto start;
}
else if(choice=='N' || choice=='n')
cout"\n\nGrand Total:"endl;
cout"\nTotal Customers : "countendl;
cout"Total Amout for all Customers :"g_totalendl;
getch();
}

is ki date extend ho gai ha. now 10 november. check it. and inform to all friends

1

2

3

4

5

## VIP Member Badge & Others

------------------------------------

## Latest Activity

8 minutes ago
8 minutes ago
+ Diamond Heart liked ZAINAB MUGHAL's discussion PARENTS
8 minutes ago
+ Diamond Heart liked ZAINAB MUGHAL's discussion RELATIONS
8 minutes ago
+ Diamond Heart liked ZAINAB MUGHAL's discussion WORDS
8 minutes ago

9 minutes ago

20 minutes ago
30 minutes ago