Assignment 2
Assignment 2
INDIVIDUAL ASSIGNMENT 2
(Due Tuesday 12 Jan 2021)
Instructions: Answer all TWO (2) questions below by writing a Java program for each of the
questions. You are required to submit an archive file (.rar or .zip) containing all of your Java
programs (Asg21.java & Asg22.java) through the UUMOnline Learning. The name of your
archive file should be STIA1113Asg2.rar or STIA1113Asg2.zip
NOTICE : If you copy someone's source codes, you are cheating and you WILL NOT get any
marks for this assignment
1. A right-angled triangle is a triangle in which one angle is a right angle (90 degrees) and the
largest side is called hypotenuse, c (refer to figure below). If the triangle is a right-angled
triangle, the relationship between the sides of the triangle is as follows:
1
2. A telecommunication provider, Maxcom, charges the following rates for telephone calls:
You are assigned by Maxcom to write a program that can calculate the call charge
made by its customers. The user needs to enter the duration (in minutes) of the call
and the rate category. The program will then display output containing the calculated
charge in 2 decimal places. Then, the program will ask whether the user want to
continue with the next calculation or quit the program. If the user chooses to continue,
the program will repeat again with a new calculation. If the user chooses to stop, the
program will display the total number of customers processed and the total charge
calculated before terminating.
An example of the program’s running is given below (Note: The bold texts below are
inputs entered by the user)
Total customer = 2
Total charge = RM6.30