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.

# 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";
cin>> typ;

switch (typ)

{
case (typ == 1):

cout "Please enter the customer number:";
cin>>cus_nub;
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;
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;}

}
)

Views: 2503

### Replies to This Discussion

qaiser abbas gud & thanks

cs201..solution

Attachments:

this is above corrected assignment

this is completely correct

#include <iostream.h>
float dom_user(int,int,int);
float com_user(int,int,int);
main()
{
int typ;
int unit;
int cus_nub;
int days;
cout"1-----------Domectice User:\n";
cout"2-----------Commercial User:\n";
cin>> typ;
while(typ<1000)
{
cin>>cus_nub;
cin>>unit;
cin>>days;

switch(typ)
{
case 1:
dom_user(cus_nub,unit,days);
break;

case 2:
com_user(cus_nub,unit,days);
break;

default:
cout"invalid entry\n";
}
system("pause");
}
}
float dom_user(int cus_nub,int unit,int days)
{
float bill;
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";
}
float com_user(int cus_nub,int unit,int days)
{
float bill;
bill = unit*15;
if(days>10)
{
bill = bill +200;
}
cout" Amount to be paid by te custoer No."cus_nub"is" bill"\n";
}

ash gud & thanks

Note @ All: You don’t need to go any other site for this assignment/GDB/Online Quiz solution, Because All discussed data of our members in this discussion are going from here to other sites. You can judge this at other sites yourself. So don’t waste your precious time with different links.

its coreect

It's wrong as you didn't use the functions

Thanks

it is not completly correct, program do not exit if we enter any other number except 1 or 2 (user type). it is compulsory .though default : "pause" , is set but i chked it , its realy dont exit .plz look into this matter. i tried to find out the problem but still not,  thanks ash.

i diidnt notice about that no i have changed the above file with correct file

1

2

3

4

5

## VIP Member Badge & Others

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

## Latest Activity

Ammara Sabir liked 刀のの尺's discussion Aԃαƙαɾι
40 minutes ago
+ Abdul Rehman Aทઽα૨i liked 刀のの尺's discussion Aԃαƙαɾι
41 minutes ago
42 minutes ago
Hasham, hira, Hassaan Ali and 1 more joined Virtual University of Pakistan
1 hour ago
Ammara Sabir updated their profile
1 hour ago

1 hour ago

1 hour ago
2 hours ago