C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 30th, 2013, 08:00 AM
nisal500 nisal500 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 2 nisal500 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 36 m 36 sec
Reputation Power: 0
Unhappy C Programming question Urgent (Plz help meeeeeeee)

1)In an Internet Café customers are charged as follows for browsing:
• First hour or part of an hour – 40 Rupees
• Next four hours – 30 Rupees per hour or part of an hour
• For each hour after that – 20 Rupees per hour or part of an hour
Write a C program using the “Else-If” statement such that when the user enters the number of hours of Internet Connection, the program displays the amount to charge from the customer.
Example: If a user browsed the Internet 3 hours and 15 minutes,
Charge = 40 Rs for the 1st hr+30*3 Rs for the next 2 hr and 15 min

2)A shop sells electrical appliances such as TVs, Fridges, Fans, and Washing Machines etc. In case the customers cannot pay the full amount to purchase an appliance the shop supports easy payment schemes, such that the customers can make the payments via monthly installments.
Four payment schemes are supported as given below:
Scheme Payment Duration No. of Installments Interest Rate %
1 6 months 6 6
2 1 year 12 8
3 1.5 years 18 10
4 2 years 24 12

Monthly Installment = (Price of the Appliance + Interest) / No. of Installments
Example: A customer buy a TV worth of 60 000 Rs, and agree to make the payments with in 1 year. i.e. The customer had selected the 2nd payment scheme.
Monthly Installment = (60 000 + (60 000*8/100)) / 12 = 5400 Rs.
Write a C program that calculates and display the value monthly installment when the user input the price of the appliance and the payment scheme. Use the “Switch” statement.


Plz help me my exams are near .

Reply With Quote
  #2  
Old January 30th, 2013, 08:08 AM
salem's Avatar
salem salem is offline
Contributed User
Click here for more information
 
Join Date: Jun 2005
Posts: 3,838 salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 153 Folding Title: Novice Folder
Time spent in forums: 2 Months 3 Weeks 2 Days 17 h 9 m 51 sec
Reputation Power: 1774
No, we will not do your homework for you
You make an effort, then we advise you on what you did right/wrong, and how to proceed towards a solution.

At the very least, for each program you should be able to
- print a prompt
- read some data

Perhaps when you've got some data sitting in front of you, the next step might be clear enough to have a go at at least.

> Plz help me my exams are near
Or you could just read my signature link.
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper

Reply With Quote
  #3  
Old January 30th, 2013, 09:11 AM
nisal500 nisal500 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 2 nisal500 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 36 m 36 sec
Reputation Power: 0
You make an effort, then we advise you on what you did right/wrong, and how to proceed towards a solution.

At the very least, for each program you should be able to
- print a prompt
- read some data

Perhaps when you've got some data sitting in front of you, the next step might be clear enough to have a go at at least.

> Plz help me my exams are near
Or you could just read my signature link.[/QUOTE]


I just did the 2nd question but cant get the correct output.
#include<stdio.h>
int main()
{

int scheme,ins,rate;
float dur,price;
float monthly;
printf("Price of the equipment \n");
scanf("&f",&price);

printf("WHAT IS UR PAYMENT DURATION in years \n");
scanf("&f",&dur);

if(dur==0.6){scheme=1;}
else if(dur==1){scheme=2;}
else if(dur==1.5){scheme=3;}
else if
(dur==2){scheme=4;}

switch (scheme)
{
case '1' : monthly=price+(price*6/100)/6;
printf("Monthly installment is %f",monthly);
break;
case '2' : monthly=price+(price*8/100)/12;
printf("Monthly installment is %f",monthly);
break;
case '3' : monthly=price+(price*10/100)/18;
printf("Monthly installment is %f",monthly);
break;
case '4' : monthly=price+(price*12/100)/24;
printf("Monthly installment is %f",monthly);
break;

return 0;

}

}

Reply With Quote
  #4  
Old January 30th, 2013, 09:35 AM
salem's Avatar
salem salem is offline
Contributed User
Click here for more information
 
Join Date: Jun 2005
Posts: 3,838 salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 153 Folding Title: Novice Folder
Time spent in forums: 2 Months 3 Weeks 2 Days 17 h 9 m 51 sec
Reputation Power: 1774
> scanf("&f",&price);
> scanf("&f",&dur);
The format character is %, not &
As in
scanf("%f",&price);


> if(dur==0.6){scheme=1;}
> ..
> case '1' : monthly=price+(price*6/100)/6;
Make your mind up as to whether it's 1 or '1'.
Either will do, so long as you're consistent about it.


Also, use [code][/code] tags when posting code.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > C Programming question Urgent (Plz help meeeeeeee)

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap