Question
Java if statement error with my code below. /** * Programmer David Anthony Martinez IS 2031 Senior Citizen Discount Program */ import java.util.Scanner; // Import
Java if statement error with my code below.
/** * Programmer David Anthony Martinez IS 2031 Senior Citizen Discount Program */
import java.util.Scanner; // Import the Scanner class
class MartinezDELE23Plan1
{ public static void main(String[] args) { Scanner input = new Scanner(System.in); // Create a Scanner object and capture entry System.out.printf("Please enter your age. ");
// hint not storing age value int val=input.nextInt(); // error with first calculation secondary is functional. if (val>=60) { System.out.printf("Congratulations, you are eligible for a senior citizen's discount of 10%! "); } // Code is functional below... else { System.out.printf("Sorry you don't qualify for a senior citizen's discount at this time! "); // terminates message below // System.exit(0); //Exit } } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started