Code CODO
Home
Basic JS
If-Else JS
If-Else JS (Part-2)
Code CODO
Chapter:- If-Else [JAVA SCRIPT] (Part-2)
If-Else (Part-2) Programming in Java Script
(1). An eletronic shop has announced the following seasonal discount on the purchase of certain items.
Purchase Amount
Discount On Laptop
Discount On Desktop
0 - 2500
0.0%
5.0%
2501 - 5700
5.0%
7.5%
5701 - 10000
7.5%
10.00%
More than 10000
10.0%
15.0%
Write a program based on the above criteria, to input name, address , amount of purchase and the type of purchsed (L for Laptop and D for Desktop) by a customer. Compute and print the net amount to be paid by the customer along with his name and address.
(2). Using a switch statement, Write a menu driven program to convert a given temperature from Fahrenheit to Celsius and vice verse. For an incorrect choice, an appropriate error message should be displayed.
(3). A cloth showroom has announced the following festivel discount on the purchase of items, based on the total cost of the items purchased:
Total Cost
Discount
Less than Rs.2000
5%
Rs.2001 to Rs.5000
25%
Rs.5001 to Rs.10000
35%
Above Rs.10000
50%
Write a program the total cost and to compute and display the amount to be paid by the customer after availling the discount.
(4). Jharkhand State Electricity Board (JSBE) Charges their consumers according to the units consumed (per month) as per the given tariff:
Units Consumed
Charges
Up to 100 units
80 Paisa/Unit
More than 100 and up to 200 unit
Rs. 1/Unit
More than 200 units
Rs. 1.25/Unit
In addition to the above,every consumer has to pay Rs.50 as service charge per month.WAP a program to calculate the Electricity Bill.
(5). Write a program that returns the commission in Rs for a salesman. The commission is based on the following conditions:
Sales
Commission
Less than Rs. 5000
5%
Rs. 5000 to Rs. 10000
8%
Above Rs. 10000
10%
(6). Write a program to compute and display the roots of a quadratic equation of the form ax2+bx+x. If b2-4ac results a negative answer, print IMAGINARY ROOTS. If b2-4ac gives a positive result, print REAL AND DISTINCT ROOTS. If b2-4ac=0, print EQUAL ROOTS.
(7). In an examination,the grades are given accordingly to the marks obtained.Write a Program in Java to display the grades accordingly:
Marks
Grades
80% and above
Distinction
60% or more but less than 80%
First Division
45% or more but less than 60%
Second Division
40% or more but less than 45%
Pass
Less than 40%
Promotion Not Granted
(8). Write a program to accept the number of days to return the book and compute the fine for member. The fine is calculated depending on the number of days a book is returned late:
Days
Fine per day in Rupees
First 10 Days
Rs.1
Next 10 Days
Rs.5
Later than 20 Days
Rs.8
(9). Write a program and print the tax payable by a salaried person. An employee to pay an income tax based on his gross annual income as follows:
Annual gross income
Annual tax deduction(%)
Less than or equal to Rs 10000
0%
10001 to 50000
Rs. 1000 + 10% of income
50001 to 80000
Rs. 5000 + 20% of income
Greater than 80000
Rs. 10000 + 30% of income
(10). Write a program to compute the amount that a customer pays for the taxi that he hires based o the following conditions:
Kilometre
Amount Per Kilometre
Upto less pr equal to 1 km
25
More than 1 to 6 km
10
More than 6 to 12 km
15
More than 12 to 18 Km
20