Java Source File
Download
/**
* HOMEWORK 1: Personal Calculator
* PT821 - Object-Oriented Programming
* Due Date: [Set by Instructor]
*
* ============================================================
* INSTRUCTIONS (READ CAREFULLY):
* ============================================================
*
* Create a personalized calculator that uses YOUR OWN information.
* This homework CANNOT be copied because it requires YOUR personal data.
*
* REQUIREMENTS:
* 1. Use your REAL registration number as the base for calculations
* 2. Use your REAL birth year in the program
* 3. Use the NUMBER OF LETTERS in your full name
* 4. All outputs must include your name and registration number
*
* TASK:
* Create a program that:
* a) Stores your registration number (e.g., "BITA/2023/0045")
* b) Extracts the last 4 digits as a number (e.g., 45 from above)
* c) Calculates: lastDigits * numberOfLettersInYourName
* d) Calculates your age from birth year
* e) Calculates: age + lastDigits
* f) Displays a formatted report with ALL calculations
*
* EXAMPLE OUTPUT FORMAT:
* ================================================
* PERSONAL CALCULATOR REPORT
* Student: [Your Full Name]
* Registration: [Your Reg Number]
* ================================================
* Last 4 digits of registration: XX
* Letters in my name: XX
* Multiplication result: XX * XX = XXX
* My birth year: XXXX
* My current age: XX
* Age + Registration digits: XX + XX = XXX
* ================================================
*
* GRADING CRITERIA:
* - Correct use of variables and data types (20%)
* - Correct calculations (30%)
* - Proper output formatting (20%)
* - Use of YOUR personal information (30%)
*
* WARNING: Submissions with fake/copied data will receive ZERO marks.
* Your registration number will be verified against university records.
*/
import java.util.Scanner;
public class Homework1_PersonalCalculator {
public static void main(String[] args) {
// TODO: Implement your solution here
// Step 1: Declare variables for your personal information
// String regNumber = "YOUR_REG_NUMBER";
// String fullName = "YOUR_FULL_NAME";
// int birthYear = YOUR_BIRTH_YEAR;
// Step 2: Extract last 4 digits from registration
// Hint: Use substring() and Integer.parseInt()
// Step 3: Count letters in your name (exclude spaces)
// Hint: Use a loop or replace(" ", "").length()
// Step 4: Perform calculations
// Step 5: Display formatted output
System.out.println("// DELETE THIS LINE AND IMPLEMENT YOUR SOLUTION");
}
}