We have been working very hard since 2009 to facilitate in your learning Read More. We can't keep up without your support. Donate Now.

www.vustudents.ning.com

 www.bit.ly/vucodes + Link For Assignments, GDBs & Online Quizzes Solution www.bit.ly/papersvu + Link For Past Papers, Solved MCQs, Short Notes & More

# Assignment No. 02 Semester: Fall 2012 CS201: Introduction to Programming

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;}

}
)

+ 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)

Views: 2458

### Replies to This Discussion

#include<iostream.h>
#include<conio.h>
int main()

{
int type;
int units;
int cust_num;
int days, bill;

cout"Press '1' ************* for Domestic user:\n"    ;
cout"Press '2' ************* for Commercial use:\n"   ;

cout"Please choose your desired type to calculate bill:  ;
cin>>type;
switch(type)
{

case 1:
cout"\nPlease enter the customer number:";
cin>>cust_num;

cout"\nPlease enter the units consumed:";
cin>>units;

cout"\nPlease enter number of days:";
cin>>days;

if (units<=100)
{
bill = units*5;
}
else if (units>i01 && units<=300)
{
bill = ((units*8) + (100));
}
else if (units>301 && units<=500)
{
bill = ((units*10) + (230))
}

cout"Amount to be paid by the customer No."cust_num" is "bill"\n";
braek;
case 2:
cout"\nPlease enter the customer number:";
cin>>cust_num;

cout"\nPlease enter the units consumed:";
cin>>units;

cout"\nPlease enter the days:";
cin>>days;

bill = units*15;
if (days>10)
{
bill += 200
}

cout"Amount to be paid by the customer No."cust_num" is "bill"\n";
break;

default:
cout"Invalid Entry";
}
system("pause");
}

#include <iostream.h>
main()
{
int type;
int unit;
int customer_number;
int days,bill;
cout"1-----------Domectice User:\n";
cout"2-----------Commercial User:\n";
cout"Please Choose your choice From the Above menu:";
cin>> type;
switch(type)
{
case 1:
cout"Please enter the customer number:";
cin>>customer_number;
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 the customer No."customer_number" is "bill"\n";
break;
case 2:
cout"Please enter the customer number:";
cin>>customer_number;
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 the customer No."customer_number" is "bill"\n";
break;
default:
cout"invalid entry\n";
}
system("pause");
}

HOw? ap ne prepare kiya hai program?

app pehle program run kar k dekh lia karen phirpost kia karen. is mei cout k baad nahi hai or bhi bht se errors hain ye program galat hai

#include
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);
}

// Semester Fall 2012 (CS201) Assignment#2

#include <iostream>
#include <conio.h>
using namespace std;
int consumer_number;
int domestic_user();
int commercial_user();

main()

system("cls");
int type;
cout" 1 . . . . . . . . Domestic User ";
cout"\n 2 . . . . . . . . Commercial User ";
cout"\n\n Please Choose Your Choice from the above menu : \t";
cin>>type;

switch(type)
{
case 1:
cout" Ammount to be Paid by Consumer Number : "consumer_number" is Rs.\t"domestic_user()"\n";
break;
case 2:
cout" Ammount to be Paid by Consumer Number : "consumer_number" is Rs.\t"commercial_user()"\n";
break;
default:
cout"\nInvalid Choice . . . \n";

} //end of switch
system("pause");
} //end of main

int domestic_user()
{
int units;
int days;
int bill;
cout" Please enter your Consumer Number : ";
cin>>consumer_number;
cout" Please enter Units Consumed : ";
cin>>units;
cout" Please enter the Number of Days : ";
cin>>days;

if(days<=10)
{
if (units<=100)
{
return bill=(units*5);
}

else if(units>100 && units<=300)

return bill=(units*8)+100;

else

return bill=units*10+230;
}

else if(units<=100)
{
return bill=(units*5)+200;
}

else if(units>100 && units<=300)

return bill=(units*8)+100+200;

else

return bill=units*10+230+200;

}

int commercial_user() // User Function
{
int units;
int days;
int bill;
cout" Please enter your Consumer Number : ";
cin>>consumer_number;
cout" Please enter Units Consumed : ";
cin>>units;
cout" Please enter the Number of Days : ";
cin>>days;
if(days>10) // if construct

return bill=units*15+200;
}
else
{
return bill=units*15;
}
}

#include <iostream.h>
int bill (int a);
int cbill (int a, int unit);
main()
{
cout "\nCS 201 Assignment # 2 Last Date 14-11-2012" endl;
cout "\n\n1------------DOMESTIC USER" endl;
cout "2------------COMMERCIAL USER";

int n;
int u,d;
int du;
int cu;

cout "\n\nChoose from above Menu as your Choice = ";
cin >> n;

switch (n)
{
case 1:
cout "\nEnter the /DOMESTIC USER/ Number = ";
cin >> n;

cout "\nPlease Enter Unit Consumed = ";
cin >> u;

cout "\nPlease Enter Days of Consumed = ";
cin >> d;

du = bill (u);
cout "\nThe total Bill of DOMESTIC USER '" n "' is = " du endl;

//******************************************************************************

case 2:
cout "\n\nEnter the /COMMERCIAL USER/ Nubmer = ";
cin >> n;

cout "\nPlease Enter Unit Consumed = ";
cin >> u;

cout "\nPlease Enter Days of Consumed = ";
cin >> d;

cu = cbill (d,u);
cout "\nThe total Bill of DOMESTIC USER '" n "' is = " cu endl;
break;

case 3:
cout "Invalid Choice";
break;

}
system("pause");

}
//******************************************************************************

int bill (int a)
{
int t;

if ((a > 0) && (a <= 100))
{
t = a * 5;
return (t);
}

if ((a > 100) && (a <= 300))
{
t = a * 8;
return (t);
}

if ((a > 300) && (a <= 500))
{
t = (a * 10) + 230;
return (t);
}
}
//******************************************************************************

int cbill (int a, int unit)
{
int t;
if (a <= 10)
{
t = unit * 15;
return (t);
}
if (a > 10)
{
t = (unit * 15) + 200;
return (t);
}
}

## Latest Activity

++ ! !!*ARhum* ! ! !++ and ASAM are now friends
23 minutes ago
24 minutes ago
25 minutes ago
26 minutes ago
57 minutes ago
HiNa HiNu updated their profile
57 minutes ago
1 hour ago
Sana Sunny ツ liked Bakhtawar khan's discussion <<,,<just joke...>>
1 hour ago

1

2

3

## HELP SUPPORT

This is a member-supported website. Your contribution is greatly appreciated!

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

.