0% found this document useful (0 votes)
2 views2 pages

Grade10 Java Exercise2

This document contains a Grade 10 Java programming exercise focused on variables, input, and arithmetic. It includes five questions that require students to write Java programs for scenarios involving pizza sharing, movie ticket revenue, change calculation, study time distribution, and paint cost estimation. Each question is worth 10 marks and emphasizes the use of user input and basic arithmetic operations.

Uploaded by

jamand
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Grade10 Java Exercise2

This document contains a Grade 10 Java programming exercise focused on variables, input, and arithmetic. It includes five questions that require students to write Java programs for scenarios involving pizza sharing, movie ticket revenue, change calculation, study time distribution, and paint cost estimation. Each question is worth 10 marks and emphasizes the use of user input and basic arithmetic operations.

Uploaded by

jamand
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

GRADE 10 JAVA PROGRAMMING — EXERCISE 2

Exercise: Variables, Input & Arithmetic

Instructions: Answer all 5 questions. Each question is worth 10 marks. Write your Java code in the
space provided. Remember to declare your variables correctly and use Scanner for user input.

Question 1 [10 marks] — Pizza Party


Scenario: A group of friends wants to share pizzas equally at a party.
Task: Write a Java program that asks the user for the number of pizzas (int) and the
number of people (int). Calculate and print how many slices each person gets (assuming 8
slices per pizza), and how many slices will be left over.
Hint: Total slices = pizzas * 8. Use / and % operators.

Question 2 [10 marks] — Movie Tickets


Scenario: A cinema wants to calculate the total revenue from ticket sales.
Task: Write a program that asks for the ticket price (as a double) and the number of tickets
sold (as an int). Calculate the total revenue. Then calculate what the cinema keeps after
giving 15% to the film distributor (multiply total by 0.85).
Hint: Calculate total first, then multiply by 0.85 for cinema's share.

Question 3 [10 marks] — Change Calculator


Scenario: A shop needs to give customers change using the fewest number of R10 notes.
Task: Write a program that asks for the amount of change owed in rands (as an int).
Calculate and print how many R10 notes to give, and how many rands will remain (which
will be given as coins).
Hint: Use / for R10 notes and % for remaining coins.

Question 4 [10 marks] — Study Time Calculator


Scenario: A student wants to divide study time equally across subjects.
Task: Write a program that asks the user for total study hours available (as an int) and
number of subjects (as an int). Calculate the average hours per subject. Print the result.
Hint: Store the result in a double to get decimal hours.
Question 5 [10 marks] — Paint Calculator
Scenario: A painter needs to estimate paint costs for a room.
Task: Write a program that asks: (1) room length in metres (int), (2) room width in metres
(int), (3) paint coverage in square metres per litre (int), and (4) price per litre of paint
(double). Calculate the room area (length * width), then litres needed (area / coverage),
then total cost.
Hint: Three calculations: area, litres, cost.

You might also like