We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More


Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

please review it and correct it 

#include <iostream>

using namespace std;


main()
{
int typ;
int unit;
int cus_nub;
int days,bill;

cout "1-----------Domectice User:";
cout "2-----------Commercial User:\n";
cout "Please Choose your chpice From the Above menu:\n";
cin>> typ;

switch (typ)

{
case (typ == 1):


cout "Please enter the customer number:";
cin>>cus_nub;
cout "Please enter unit consumed:";
cin>>uint;
cout "Please enter number of days:";
cin>>days;
if ( uint 100=<, )
{
bill=uint * 5 }
else if (unit 101=> && =>300)
{ bill = ((uint*8)+100)
}
else if (uint 301=> && =>500)
{ bill = ((unit * 10) + 230)}
}
break;
case (typ == 2)
cout t "Please enter the customer number:";
cin>>cus_nub;
cout "Please enter unit consumed:";
cin>>uint;
cout "Please enter number of days:";
cin>>days;
bill = uint*15
}}

if (days 11=>)
{ bill = bill +200 }
cout " Aount to be paid by te custoer No."cus_nub "is" bill n/;


break;
default:

cout "invalid entry\n";
break;}

}
)

+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?


See Your Saved Posts Timeline

Views: 2422

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Replies to This Discussion

correct file

Attachments:

Sorry ash, again it does not exit the program, its just shows , invalid choice, press any key to continue after press any key its again shows , invalid choice , press any key and this shows again and again.

i am just facing this problem.

any ways , good effort.

actually i m sorry  mujhe pahlay pata nai chala tha ap kya kahna chah rahe ho

Attachments:
it is correct but it is not reappearing again again as given in assignment

Kindly someone please upload complete assignment No 2 question file...from LMS

thanx,tariq,........thank,u,v.much.,m,using,this,site,for,the,first,time.

Asslam.o.alaikum

Take this solution and try to make your own

I try to explain how did i make it

we were asked for a program that calculating the amount of bill paid by the customer for both domestic and commercial usage. User will enter customer number and amount of units consumed, and the program will calculate the amount of bill accordingly.

 I used simple break and continue statement with conditions and functions according to assignment

/****************** CS201  Assignment No. 2  :  vustudents.ning **********************/

#include <iostream.h>

main()
{
int typ;
int unit;
int cus_nub;
int days,bill;

// now printing domectic and commercial user
cout"1-----------Domectice User:\n";
cout"2-----------Commercial User:\n";

// now taking his/her choice
cout"Please Choose your choice From the Above menu:";
cin>> typ;
switch(typ)
{

// switch statement
case 1:

// taking input as customer number
cout"Please enter the customer number:";
cin>>cus_nub;

// taking input as unit consumed
cout"Please enter unit consumed:";
cin>>unit;

// taking input as number of days
cout"Please enter number of days:";
cin>>days;

// now condition
if(unit<101)
{
bill=unit * 5;
}
else if(unit>101 && unit<301)
{
bill = ((unit*8)+100);
}
else if(unit>301 && unit<501)
{
bill = ((unit * 10) + 230);
}

// showing out by printing Amount to be paid by the customer No.
cout" Amount to be paid by the customer No."cus_nub"is" bill"\n";
break;
// if condition successfully run it will break and show out put otherwise it will ask again again customer number and same  procedeure
case 2:
cout"Please enter the customer number:";
cin>>cus_nub;
cout"Please enter unit consumed:";
cin>>unit;
cout"Please enter number of days:";
cin>>days;
bill = unit*15;
if(days>10)
{
bill = bill +200; 
}
cout" Amount to be paid by te customer No."cus_nub"is" bill"\n";
break;
//if again condition failed it will show a invalid entry message and break
default:
cout"invalid entry\n";
}

//for program close
system("pause");
}

Hope so you understand

now paste this code in your dev c++ , compile and run but again request don't submit it..... make your own its just to clear you confusions

#include <iostream.h>

main()
{
int typ;
int unit;
int cus_nub;
int days,bill;
cout"1-----------Domectice User:\n";
cout"2-----------Commercial User:\n";
cout"Please Choose your choice From the Above menu:";
cin>> typ;
switch(typ)
{
case 1:
cout"Please enter the customer number:";
cin>>cus_nub;
cout"Please enter unit consumed:";
cin>>unit;
cout"Please enter number of days:";
cin>>days;
if(unit<101)
{
bill=unit * 5;
}
else if(unit>101 && unit<301)
{
bill = ((unit*8)+100);
}
else if(unit>301 && unit<501)
{
bill = ((unit * 10) + 230);
}
cout" Amount to be paid by te custoer No."cus_nub"is" bill"\n";
break;

case 2:
cout"Please enter the customer number:";
cin>>cus_nub;
cout"Please enter unit consumed:";
cin>>unit;
cout"Please enter number of days:";
cin>>days;
bill = unit*15;
if(days>10)
{
bill = bill +200; 
}
cout" Amount to be paid by te custoer No."cus_nub"is" bill"\n";
break;

default:
cout"invalid entry\n";
}
system("pause");
}

is Assgn m ye to given he nahi hy k bill deposit ki date kia hy us ny btaya k agar days>10 ho to  he/she will be charged 200.    agar last date he nahi btaai to >10 ka kia bany ga

take these three program as example

and try to make hope so u wil get great idea

#include<iostream.h>
using std::cout;
using std::endl;
main()
{
// declaration of variables..........
char model,name[15], car#[15]; 
int days, amount, rentalAmount=0;
// little description and prompt the user user to type the input..
cout" Please provide the customer Name: " endl;
cin>> name;
cout" Please provide the Car Model Description. " endl;
cout"\t Enter 'A' for Model 2009. " endl;
cout"\t Enter 'B' for Model 2010. " endl;
cout"\t Enter 'C' for Model 2011. " endl;
cin>> model;
cout " Please provide the following information : " endl;
cout" Car No. : " endl;
cin>> car#;
cout" Number of day's : " endl;
cin>> days;
if (model == 'A')
{
amount = 5000;
model = 2009;
rentalAmount = (amount * days);
cout"======================================" endl;
cout"Customer Name :" name;
cout"\n""Car Model :" model ;
cout"\n""Number of days :" days;
cout"\n""Your Rental Amount is :" rentalAmount ;
cout"\n""======================================" endl;
break; 

else if (model == 'B')
{
amount = 8000;
model = 2010;
rentalAmount = (amount * days);
cout"======================================" endl;
cout"Customer Name :" name;
cout"\n""Car Model :" model ;
cout"\n""Number of days :" days;
cout"\n""Your Rental Amount is :" rentalAmount ;
cout"\n""======================================" endl; 
break; 

else if (model == 'C')
{
amount = 10000;
model = 2011;
rentalAmount = (amount * days);
cout"======================================" endl;
cout"Customer Name :" name;
cout"\n""Car Model :" model ;
cout"\n""Number of days :" days;
cout"\n""Your Rental Amount is :" rentalAmount ;
cout"\n""======================================" endl; 
break;

}

#include<iostream.h>

int amount(char, int);

main()

{
      int days;
      int rent;
      char model; 
      char name[20];
      char carNo[10];

      cout "Please provide cumstomer Name\t";
      cin >> name;
      
      cout "\nPlease provide Car Model Description" endl endl;
      cout "\tEnter 'A' for Model 2009.\n";
      cout "\tEnter 'B' for Model 2010.\n";
      cout "\tEnter 'C' for Model 2011.\n";
      cin >> model;
      
      cout "\nplease provide following information:" endl endl;
      cout "Car No:\t\t";
      cin >> carNo;
      
      cout "Number of days\t";
      cin >> days;
      cout endl endl;
      
      switch(model)
      {
           case 'A':
           case 'a': 
                      cout "Customer Name:\t" name endl;
                      cout "Car Model:\t2009" endl;
                      cout "Car No:\t\t" carNo endl;
                      cout "Number of days:\t" days endl;
                      rent = amount(model, days);
                      cout "Your Rental Amaount is:\t" rent endl;
           break;

           case 'B':
           case 'b': 
                      cout "Customer Name:\t" name endl;
                      cout "Car Model:\t2010" endl;
                      cout "Car No:\t\t" carNo endl;
                      cout "Number of days:\t" days endl;
                      rent = amount(model, days);
                      cout "Your Rental Amaount is:\t" rent endl; 
           break;
           
           case 'C':
           case 'c': 
                      cout "Customer Name:\t" name endl;
                      cout "Car Model:\t2011" endl;
                      cout "Car No:\t\t" carNo endl;
                      cout "Number of days:\t" days endl;
                      rent = amount(model, days);
                      cout "Your Rental Amaount is:\t" rent endl;
           break;
           
           default:
                   cout "please select only 2009, 2010, 2011 car models";
           
           }

      system("pause"); 
      }
     
int amount(char m, int d){
    if(m == 'A' || m == 'a')
    return (5000 * d);
    
    else if(m == 'B' || m == 'b')
    return (8000 * d);
        
    else if(m == 'C' || m == 'c')
    return (10000 * d);
    } 

#include <iostream.h>
#include <conio.h>

double TotalPayAbleRent(int,int);
main()
{
char name[20], choice,vehicle_number[20];
int total_days,amount_of_day1,amount_of_day2,amount_of_day3,model1,model2,model3;
model1 = 2009;
model2 = 2010;
model3 = 2011;
amount_of_day1 = 5000;
amount_of_day2 = 8000;
amount_of_day3 = 10000;
cout"=======CODDED BY: ALIMS(for those who are not much familiar with C++)=======";
cout"\n""provide customer name :";
cin>>name;
cout"Please provide Car Description";
cout"\n""Enter 'A' for model 2009";
cout"\n""Enter 'B' for model 2010";
cout"\n""Enter 'C' for model 2011";
cin>>choice;
cout"Please enter car number :";
cin>>vehicle_number;
cout"Please enter number of days :" ;
cin>>total_days;


if(choice=='a')
{

cout"~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*." endl;
cout"Customer Name :" name;
cout"\n""Car Model :" model1 ;
cout"\n""Number of days :" total_days;
cout"\n""Your Rental Amount is :" TotalPayAbleRent(amount_of_day1,total_days);
cout"\n""~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*." endl;
}
else if(choice=='A')
{

cout"~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*." endl;
cout"Customer Name :" name;
cout"\n""Car Model :" model1 ;
cout"\n""Number of days :" total_days;
cout"\n""Your Rental Amount is :" TotalPayAbleRent(amount_of_day1,total_days);
cout"\n""~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*." endl;
}
else if(choice=='B')
{

cout"~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*." endl;
cout"Customer Name :" name;
cout"\n""Car Model :" model2 ;
cout"\n""Number of days :" total_days;
cout"\n""Your Rental Amount is :" TotalPayAbleRent(amount_of_day2,total_days);
cout"\n""~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*." endl;
}
else if(choice=='b')
{

cout"~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*." endl;
cout"Customer Name :" name;
cout"\n""Car Model :" model2 ;
cout"\n""Number of days :" total_days;
cout"\n""Your Rental Amount is :" TotalPayAbleRent(amount_of_day2,total_days);
cout"\n""~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*." endl;
}
else if(choice=='C')
{

cout"~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*." endl;
cout"Customer Name :" name;
cout"\n""Car Model :" model3 ;
cout"\n""Number of days :" total_days;
cout"\n""Your Rental Amount is :" TotalPayAbleRent(amount_of_day3,total_days);
cout"\n""~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*." endl;
}
else if(choice=='c')
{

cout"~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*." endl;
cout"Customer Name :" name;
cout"\n""Car Model :" model3 ;
cout"\n""Number of days :" total_days;
cout"\n""Your Rental Amount is :" TotalPayAbleRent(amount_of_day3,total_days);
cout"\n""~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*." endl;
}
else
{
cout"insaan ban kar sahi input do";
}

getch();
}
double TotalPayAbleRent(int rentofday,int tdays)
{
return rentofday*tdays;
}

#include<iostream>
#include<conio.h>
#include <string.h>
using namespace std;
int main()
...{
char Model;

string Name;

string CarNo;

int Day, Amount, flag=0, CarMod;

cout "Please provide customer name: ";

cin >>Name;

cout "\n\nPlease provide car model description:"endl endl;

cout " Enter 'A' for Model 2009" endl;

cout " Enter 'B' for Model 2010" endl;

cout " Enter 'C' for Model 2011" endl;

cout "\nCar Model: ";

cin >>Model;

while (flag!=1)
{
if (Model=='A' || Model=='a')
{
Amount=5000;
CarMod=2009;
flag=1;
}
else if (Model=='B' || Model=='b')
{
Amount=8000;
CarMod=2010;
flag=1;
}
else if (Model=='C' || Model=='c')
{
Amount=10000;
CarMod=2011;
flag=1;
}
else
{
cout "\nPlease Enter 'A', 'B' or 'C' only" endl;
cout "\nCar Model: ";
cin >>Model;
}
}
cout "Please provide following information:"endl;

cout "\nCar No. : ";

cin >>CarNo;

cout "Number of days: ";

cin >>Day;

cout "\n-------------------------------------------"endl;

cout "Customer Name : " Name endl;

cout "Car Model : " CarMod endl;

cout "Car No. : " CarNo endl;

cout "Number of days : "Day endl;

cout "Your rental amount is : "Amount*Day;

cout "\n-------------------------------------------";
getche();
}

RSS

© 2020   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service

.