Lab 3
Lab 3
Objective: The primary objective of this lab is to provide you with a solid understanding of the
following key concepts:
Task 1:
Design a java application for the Sales Department which wants to generate a report that
calculates the total revenue from multiple sales entries for each month, allowing flexibility in the
number of inputs. The system should accept the name of the month and a variable number of
sales as double values and generate a formatted report displaying each entry of month along with
the total sales. Since the number of revenue sources may vary each month, the implementation
should be able to dynamically handle different numbers of sales figures without requiring
overloaded methods. The report should ensure precise financial calculations and provide a clear,
professional output.
Sample Output:
Write an application that inputs five numbers, each between 10 and 100, inclusive. As each number
is read, display it only if it’s not a duplicate of a number already read. Provide for the “worst case,”
in which all five numbers are different. Use the smallest possible array to solve this problem.
Display the complete set of unique values input after the user enters each new value.
Task 3:
Write an application to simulate the rolling of two dice. The application should use an object of
class Random once to roll the first die and again to roll the second die. The sum of the two
values should then be calculated. Each die can show an integer value from 1 to 6, so the sum of
the values will vary from 2 to 12, with 7 being the most frequent sum, and 2 and 12 the least
frequent. Figure below shows the 36 possible combinations of the two dice. Your application
should roll the dice 36,000,000 times. Use a one-dimensional array to tally the number of times
each possible sum appears. Display the results in tabular format.
Task 4:
A university wants to develop a Grade Management System to store and analyze students' grades
across multiple subjects. Each student is enrolled in multiple courses, and their grades for
different assignments or exams need to be recorded and processed efficiently. The system should
use a multi-dimensional array to store student grades, calculate the average grade per student,
and identify the top-performing student in the class.
Store student grades in a 2D array, where rows represent students and columns represent grades
in different subjects. Allow the system to calculate the average grade for each student. Identify
the top-performing student based on their average grade. Display a formatted report of students'
grades and their performance analysis. Use separate methods to calculate average, displaying
grades and finding top student.
Create a financial application in Java which requires a Currency Converter that allows users to
convert an amount from one currency to another using command-line arguments. The system
should accept the amount, source currency, and target currency as input and return the converted
amount based on predefined exchange rates.
Requirements:
Deliverables: Submit a single file on LMS before the due date as communicated by Lab
Engineer. Please attempt the lab quiz at the defined time.
Note: Write your registration number and name at the top of each code. You will submit your
working codes and outputs (Just Screenshots) in the Lab Report.