Create a program that will calculate a student's total payment fee after a scholarship has been applied. Scholarship.java will contain two methods: setGrade() and getScholarship(). The setGrade() will process the scholarship application, and will set new amount to be paid, while getScholarship() will only return the new amount after being called.
GPAs ranging from 1.76 to 5.00 will not be eligible for a scholarship and must pay the full tuition. GPAs ranging from 1.46 to 1.75 will receive a partial scholarship. GPAs ranging from 1.00 to 1.45 will receive a full scholarship. Out-of-range GPAs are invalid.
In the main class (SurnameScholarship.java), the user will be asked to enter his/her GPA, tuition fee, and miscellaneous fee.
Create a java program which allows the user to enter two values (Using JOptionPane) to be divided. The program catches an exception if either of the entered values is not an integer.
Declare three integers—two to be input by the user and a third to hold the result after dividing the first two. The numerator and denominator variables must be assigned starting values because their values will be entered within a try block. Also declare an input String to hold the return value of the JOptionPane showInputDialog() method.int numerator = 0, denominator = 0, result; String display;
Add a try block that prompts the user for two values, converts each entered String to an integer, and divides the values, producing result(Cast the result to a double).
Add a catch block that catches an Arithmetic Exception object if division by 0 is attempted. If this block executes, display an error message, and force result to 0.
The program shall:
• generate a random number from 1 to 50 for a player to guess;
• display a message that indicates whether the player's guess is correct, too low, or too high; • prompt the user to keep on guessing until the correct value is entered
4. Create a try-catch structure that will handle two (2) exceptions. These are when the user inputs the following:
• a number that is out of range (1 - 50) a letter or any non-numeric character
5. Prompt the user so that he can guess again if an exception is thrown.
6. Display the number of total guesses.
Note: An invalid input (when an exception is thrown) is not considered a valid guess or attempt.
Write a static method called dollarToPeso that takes a dollar amount as parameter and returns its equivalent in pesos. Assume that the conversion rate is 1 dollar = 48.45 pesos. Use this method in the program.
Sample output:
Enter dollar amount: 50
$ 50 = P 2,422.5
In physics, an object that is in motion is said to have kinetic energy. The following formula can be used to determine a moving object’s kinetic energy:
KE=1/2mv2
The variables in the formula are as follows: KE is the kinetic energy, m is the object’s mass in kilograms, and v is the object’s velocity in meters per second.
1. Write a function named kinetic_energy that accepts an object’s mass (in kilograms) and velocity (in meters per second) as arguments. The function should return the amount of kinetic energy that the object has.
2. Write a statement that calls the kinetic_energy function to get and display the kinetic energy of an object with the mass of 5 kilograms and velocity of 20 meters per second
Build a simple “English Language” calculator that does the following:
● Takes three inputs from the keyboard
● Two of the inputs are single-digit numbers (0 to 9)
● The third input is a char from the keyboard, representing one of the five operations from the keyboard:
○ + (addition)
○ - (subtraction)
○ * (multiplication)
○ / (division)
○ ^ (exponentiation)
● Output the description of the operation in plain English, as well as the numeric result
Write a program that reads a web address (for instance, www.yahoo.com) from the keyboard and outputs whether this web address is for a government, a university, a business, a non-profit organization, or another entity.
● If the web address ends with gov, it is a government web address.
● If the web address ends with edu, it is a university web address.
● If the web address ends with com, it is a business web address.
● If the web address ends with org, it is a non-profit organization’s web address.
Otherwise, it is a web address for another entity
(a) Create a class named Invoice containing fields for an item number, name, quantity, price, and total cost. Create a constructor to pass the value of the item name, quantity, and price. Also include displayLine() method that calculates the total cost for the item (As price times quantity) then displays the item number, name, quantity price, and total cost. Save the class as Invoice.java.
(b) Create a class named TestInvoice whose main() method declares three invoice items. Provide values for each, and display them. Save the application as TestInvoice.java.
Required Object Class and Driver Class ,Write a Java program to do the following
a) Read two-dimensional array (3 x3)
b) Find the diagonal elements of the array
Write a Java driven application with the following requirements:
1. Must enter names of students.
2. Enter test 1, 2 and 3 scores for each of my students.
3. Program must calculate the average of each student.
4. Average of each student must appear below their names. ARRAY and MENU implementation should be necessary.