Input
The four numbers
Description
N/A
Constraints
N/A
Sample
N/A
Output
The first four lines will contain message prompts to input the four numbers.
The last line will contain the sum of all positive numbers with two decimal places.
Enter·the·first·number:·12.1
Enter·the·second·number:·-321
Enter·the·third·number:·53.3
Enter·the·fourth·number:·-34
Sum·of·all·positive·numbers·=·65.40
Input
The first number, second number, third number, fourth number and fifth number contains:
Description
N/A
Constraints
This may be a decimal number.
Sample
N/A
Output
The first line will contain a message prompt to input the first number.
The second line will contain a message prompt to input the second number.
The third line will contain a message prompt to input the third number.
The fourth line will contain a message prompt to input the fourth number.
The fifth line will contain a message prompt to input the fifth number.
The last line contains the sum of all negative numbers rounded off and displayed with 2 decimal places.
Enter·the·first·number:·34
Enter·the·second·number:·43.5
Enter·the·third·number:·-53.24
Enter·the·fourth·number:·56.3
Enter·the·fifth·number:·-10.32
Sum·of·all·negative·integers·=·-63.56
Add a subclass named Finance_Period that will determine if a customer will pay interest or not. If the number of months to pay for the product is greater than three, the customer will pay 25% interest, else no interest applies. The maximum number of months to pay for the product is 12. Override the calculate_repayment () method by determining if the customer will pay interest or not and calculate the monthly repayment amount.
Create a class called Customer_Finance that contains the logic to test the two classes. Prompt the user for data for the first object where no interest applies and display the results; then prompt the user for data where interest is applicable and display the results.
10% discount to children who are not more than 12 years old or senior citizens who are at least 65 years old. It is further stated that ONLY those who are visiting the Park for at least the 5th time will qualify for this discount
public class KrugerNationalPark {
public static void main(String[] args){
String Age, Visit;
Age = 18;
Visit = 10;
decideDiscount(Age, Visit);
}
public static void decideDiscount(double A, char V)
{
if ((A <= 12 && >= 65) && (V >= 5));
System.out.print("You qualify for 10% discount!")
System.out.print("You deserve it!")
else
System.out.print("You do not qualify for discount")
}
}
the program is not executing due to at least 10 syntax errors.
1) You are required to debug the program and re-write the program without errors.
2) Re-write your program in such a way that method decideDiscount() can return a value to the calling method. The calling method will then display if a customer qualifies for a discount or not.
2. Write a java program named StampCalc.java. This program will input 3 int values from the command-line. The first will represent the number of First Class stamps requested, the second number will indicate the number of Additional Ounces needed for those first class letters, and the third number will indicate the number of International stamps requested.
The cost for First Class stamps is $.50, the cost for an Additional Ounce is $.21, and the cost for an International stamp is $1.15.
Your program will calculate the total cost for the requested number of stamps.
If the command-line values were: 5 2 6
Your output should show just one line:
The total for 5 First Class stamps, 2 additional ounces and 6 International stamps is $9.82