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

23-24-Iteration-for loop-Assignment

The document contains a series of Java programming assignments for Grade 9 students focused on iteration through loops. It includes tasks such as printing sequences, calculating averages, generating ID numbers, and computing bills based on various scenarios. Each assignment progressively builds on programming concepts and requires students to apply their knowledge in practical coding exercises.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

23-24-Iteration-for loop-Assignment

The document contains a series of Java programming assignments for Grade 9 students focused on iteration through loops. It includes tasks such as printing sequences, calculating averages, generating ID numbers, and computing bills based on various scenarios. Each assignment progressively builds on programming concepts and requires students to apply their knowledge in practical coding exercises.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

2022-2023 UNIT 4-ITERATION THROUGH LOOPS GRADE 9

ASSIGNMENT – 1

1. Write a program in Java to print “VSA” 5 times using for loop.

2. Write a program in Java to print all natural numbers from 1 to 10

3. Write a program in Java to print numbers from 20 to 1.

4. Write a program in Java to print Even numbers between 1 to 25.


2022-2023 UNIT 4-ITERATION THROUGH LOOPS GRADE 9

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.

2. Write a program in Java to input the computer marks of 35 students, calculate


the average of a class.

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.

4. Robotics is an organization with 100 employees. WAP to accept the basic


salary of each employee working in the organization, Calculate and display
their gross salary and net salary.
HRA = 20% of basic
DA = 25% of basic
CTA = 10% of basic
PF = 12% of basic
Gross salary = basic + HRA + DA+ CTA
2022-2023 UNIT 4-ITERATION THROUGH LOOPS GRADE 9
Net salary = Gross salary – PF

ASSIGNMENT – 3

1. WAP to calculate and display the commission of 40 salesmen in a company


by accepting their sales as an input along with their names. The
commission is calculated according to the following rates.

2. A cloth showroom has announced the following festival discounts on the purchase
of items, based on the total cost of the items purchased:

Write a program in JAVA to calculate and display the net bill


amount after discount for 20 customers.

3. Write a program in JAVA that accepts 10 integers and do the following:

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

1. WAP to find the sum of the following series:


a. s = 1 + 2+ 3………..+10
Web. s=1 + 3+5+………+15
c. s= 30+25+20…..+0
d. s=1*2*3*4*………..*10
e. s=n*(n-1)*(n-2)……*1(Assume n=5)
f. s= 1/1 + 1 /2 + 1/3 + ---------+ 1/n;
g. s = 1/2 + 1 /4 + 1/6 + ---------+ 1/n;
h. s = 1/1 + 1 /3 + 1/5 + ---------+ 1/n;
i. s = a/1 + a/2 + a/3 + a/4 + --------- + a/n;
j. s = 1/2 + 2 /3 + 3/4 + ---------+ n/n+1;
k. s = (1 * 2) + (2 * 3) +(3 * 4) + ---------+ ( n * (n + 1))
l. s = 1 + 4 + 9 + 16 + ---------n2
m. s = 0 + 7 + 26 + 63+ -------- n
n. s = 1 + X1+ X 2 + X 3 + X z
4+---+Xn
o. s = 1+ 3+ 6+ 10+ 15 - -N
p. s = 1 +11+111+1111…..n
q. s= 0.3 + 0.33+ 0.333+ 0.3333+ 0.333333
r. S=1-2+3-4+5…….-10
s. s = a - a/2 + a/3 - a/4 + --------- a/n;
t. s = a/2 - a/4 + a/6 - a/8 + --------- a/n;
u. s = 1^2 + 3^ 5 + 5^2 + 7^5 .......N
2022-2023 UNIT 4-ITERATION THROUGH LOOPS GRADE 9
ASSIGNMENT – 6

1. Write a program in Java to find the factorial of a number.


(Hint: factorial of n(n!) is ( 1* 2* 3* ….*n)

2. Write a program in Java to print the Fibonacci


series up to a certain range.
(0 1 1 2 3 5 8 13……)

3. Write a program in Java that accepts a positive integer, count, and display
the divisors a number.

4. Write a program in Java to input a number and then check if it is a prime


number or not.
2022-2023 UNIT 4-ITERATION THROUGH LOOPS GRADE 9

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

2. An electricity board charges the bill depending on the number of units


consumed as follows:

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.

You might also like