23-24-Iteration-for loop-Assignment
23-24-Iteration-for loop-Assignment
ASSIGNMENT – 1
ASSIGNMENT – 2
1. Printeo Pvt Ltd. prints Identity Cards for students. Write a program in Java to
accept grade and section of a class, generate ID numbers for each student, and
accept the names for all 30 students of a class. Print it along with a suitable
caption.
3. D2P2 Hypermart is offering a festival discount of 5% on the total bill for each
customer. Write a program in Java to generate a Total bill for 10 customers by
accepting 3 items purchased, their respective price and
quantity. Calculate and print the total bill after a discount
for each of them.
ASSIGNMENT – 3
2. A cloth showroom has announced the following festival discounts on the purchase
of items, based on the total cost of the items purchased:
a. Find out the largest number from the list (Hint: Only for Positive numbers)
b. Find out the smallest number from the list (Hint: Only for Positive numbers)
c. Find both largest and the smallest from the list (Hint: Consider negative
numbers also)
d. Find the largest even number from the list (Consider negative numbers also)
2022-2023 UNIT 4-ITERATION THROUGH LOOPS GRADE 9
ASSIGNMENT – 4
1. Write a program to input names and heights of 10 different trees, display the name
and the height of the tallest tree.
2. Write a program in java to accept the name and its life span for 10 different
animals and display the animal with the least lifespan.
3. Wood-Works is a furniture shop, which sells sofa sets through bidding. Write a
program in java to input the name and the bidding price of 20 different customers.
Display the name and the price of the person with
the highest bid.
4. Write a program in java to print the question “Who is the inventor of Java?”. The
program allows the user to make 3 attempts to answer the
question. If the user enters the right answer, the program
displays “Correct” else if the user does not type the correct
answer even after 3 attempts the program should display the
correct answer.
2022-2023 UNIT 4-ITERATION THROUGH LOOPS GRADE 9
ASSIGNMENT – 5
3. Write a program in Java that accepts a positive integer, count, and display
the divisors a number.
ASSIGNMENT – 7
1. Write a program in Java to accept the number of words and hence compute
the Telegram charges for 50 customers as follows:
Upto10 words (inclusive): ₹ 3.50
Each additional word: ₹0.50
Write a program in Java to accept the name of the customer, meter number,
and the units consumed. Calculate and print the net bill for 20 customers’
needs to pay along with his/her name. The net bill also includes a rent of
₹250.00 charged from each consumer.