This repository contains Java solutions for three exercises designed to enhance your programming skills. Below you'll find descriptions of each exercise along with instructions on how to run the programs.
In this exercise, you'll find a Java application that simulates a test. It includes the following features:
- Five multiple-choice questions based on the first three lectures of the course.
- A
Testclass with programmer-defined methods for simulating questions, checking answers, generating messages, and interacting with the user. - Questions displayed using the
JOptionPaneclass. - Random congratulatory or corrective messages for user responses.
- Display of correct and incorrect answers, along with the percentage of correct answers at the end of the test.
To run the test simulator, simply create a Test object and start the test by calling the inputAnswer method from the main class.
In this exercise, you'll find a Lotto class designed to simulate a simple lotto game. Here's what it includes:
- The
Lottoclass with an array instance variable to hold three random integer values between 1 and 9. - A constructor that randomly populates the array for a
Lottoobject. - A method to return the array.
- Interaction with the user using
JOptionPanemethods.
To play the lotto game, the user chooses a number between 3 and 27. The lotto runs up to 5 times, and each time the sum of the lotto numbers is calculated. If the user's chosen number matches the sum, the user wins; otherwise, the computer wins if there's no match within five rolls.
This exercise involves writing a Java class with three overloaded static methods. Here's what it includes:
- Three overloaded static methods with different sets of parameters performing similar functionalities.
- Calling these methods within the
mainmethod and displaying the results.
To run this exercise, simply call the methods within the main method and observe the results.
To run each exercise:
- Compile the Java files.
- Execute the compiled files, ensuring that you have Java installed on your system.