Assignment Java
Assignment Java
THEORY PART
IMPLEMENTATION PART
Read all instructions, requirements, grading criteria and submission details carefully.
1. Basic Calculator
Objective: The objective of this program is to create a basic calculator in Java. The program should
be able to perform arithmetic operations such as addition, subtraction, multiplication, and
division.
Requirements:
• Your program should have a well-structured Java code with appropriate comments. It
should include a Main class with a main method as the entry point of the program.
• Use the Scanner class to take user input in the form of an expression, for example, '5 +
10', which consists of two numbers and the desired arithmetic operation (addition,
subtraction, multiplication, or division).
• Implement control flow structures like conditional statements for performing the selected
operation).
• Handle any necessary type casting when performing operations or displaying results.
Ensure data integrity and handle errors appropriately.
• Compile and run your Java program. Ensure that it is free of errors and runs successfully.
• Provide clear and concise documentation explaining how to use your calculator program.
Include instructions for inputting numbers and selecting operations.
• Add error handling to your program to handle scenarios like division by zero or invalid
input.
EXAMPLE OUTPUT:
Objective:
The objective of this program is to practice working with strings, arrays, type casting, and control
statements (if and switch) in Java. You will be given a string containing a list of student names and
their scores. Your task is to process this data and perform various operations on it.
Instructions:
a. Declare and initialize a string variable called "studentData" with the following sample data:
b. Split the "studentData" string into an array of individual student records. Each record contains
a student's name followed by a colon and their score.
c. Find and display the highest score and the name of the student who achieved it.
d. Find and display the lowest score and the name of the student who achieved it.
Test your program with different inputs and ensure it handles the data correctly and provides the
expected output.
NOTE: To convert a number from an input string to an integer, you can use the Integer.parseInt()
method. For example, if s = "5", you can use int a = Integer.parseInt(s);.
Grading Criteria:
Your assignment will be evaluated based on the following criteria:
. Submission Details:
• You should submit Java programs as a .java file along with a README file, for each
program, containing instructions on how to compile and run the program.
• You should also provide a brief explanation of the design and implementation choices
you made.
• Both the theory and implementation parts should be submitted in a “handwritten
format”, and a soft copy of the implementation part is also required.
• Last Date: On the next class.