0% found this document useful (0 votes)
68 views

Assignment 4

The document contains 5 programming assignments in C: 1. Write a program to calculate an electricity bill based on unit consumption tiers and apply a surcharge if over $400. 2. Write a program to read a month number and display the corresponding month name. 3. Write a program to read a week number and display the corresponding day of the week using a switch case. 4. Write a program to create a basic calculator using switch case and functions. 5. Write a program to read a character and determine if it is a vowel or consonant using a switch case.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views

Assignment 4

The document contains 5 programming assignments in C: 1. Write a program to calculate an electricity bill based on unit consumption tiers and apply a surcharge if over $400. 2. Write a program to read a month number and display the corresponding month name. 3. Write a program to read a week number and display the corresponding day of the week using a switch case. 4. Write a program to create a basic calculator using switch case and functions. 5. Write a program to read a character and determine if it is a vowel or consonant using a switch case.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment 4

1. Write a program in C to calculate and print the Electricity bill of a given customer. The
customer id., name and unit consumed by the user should be taken from the keyboard and
display the total amount to pay to the customer. The charge are as follow: 

Unit Charge/unit

upto 199 @1.20

200 and above but less than 400 @1.50

400 and above but less than 600 @1.80

600 and above @2.00

If bill exceeds Rs. 400 then a surcharge of 15% will be charged and the minimum bill should be
of Rs. 100/-
Test Data:
1001
James
800
Expected Output :
Customer IDNO :1001
Customer Name :James
unit Consumed :800
Amount Charges @Rs. 2.00 per unit : 1600.00
Surchage Amount : 240.00
Net Amount Paid By the Customer : 1840.00

2. Write a program in C to read any Month Number in integer and display Month name in the
word. 
Test Data :
4
Expected Output :
April

3. Write a program in C to print day of week name using switch case

Test Data:

1
Input week number(1-7): 2

Expected Output :
Tuesday

4. Write a program in C to create calculator using switch case and functions


Test Data:
Enter the value 1: 20
Enter the value 2: 60
Enter the operation want to perform: +

Expected Output :
Sum is: 80

5. Write a program in C to check vowel or consonant using switch case.


Test Data:
Enter a Character: e

Expected Output :
It’s a Vowel

You might also like