Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
I need help with this java problem described below:
import java.util.Scanner;
import java.util.InputMismatchException;
public class ExpirationMonth {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int expirationMonth;
boolean valueFound = false;
while (!valueFound) {
try {
expirationMonth = scnr.nextInt();
valueFound = true;
System.out.println("Expiration month: " + expirationMonth);
System.out.println("Processed one valid input value");
}
/* Your code goes here */
}
}
}
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 4 steps with 2 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- pls help make a pseudo code for the the java code below thank youarrow_forwardimport java.util.Scanner; public class MealEstablishmentDirectory { public static void main (String[] args) { Scanner scnr = new Scanner(System.in); int newRating; String newState; MealEstablishment mealEstablishment1 = new MealEstablishment(); System.out.println("Default values: "); mealEstablishment1.print(); newRating = scnr.nextInt(); newState = scnr.next(); mealEstablishment1.setRating(newRating); mealEstablishment1.setState(newState); System.out.println("After mutator methods: "); mealEstablishment1.print(); } }arrow_forwardPlease Solve it in javaarrow_forward
- Please write in Java import java.util.Scanner; public class ConcertPromoter { public static void main(String[] args) { Scanner key = new Scanner(System.in); Concert concert = new Concert(); System.out.println("Welcome to the Concert Promotion tool!"); String input = ""; while(input.equalsIgnoreCase("quit")!= true) { System.out.println("Currently the concert featuring the band: "+concert.getBandName()); System.out.println("Has sold "+concert.getNumTicketsSoldByPhone()+" tickets by phone"); System.out.println("Has sold "+concert.getNumTicketsSoldAtVenue()+" tickets at the venue"); System.out.println("And has grossed $"+concert.totalSales()); System.out.println("What would you like to do?\n" + "Enter 1: To change name\n" + "Enter 2: To change ticket by phone price\n" + "Enter 3: To change ticket at venue price\n" + "Enter 4: To add tickets by phone\n" + "Enter 5: To add tickets at the venue\n" + "Enter…arrow_forwardQuestion 2. package sortsearchassigncodeex1; import java.util.Scanner; import java.io.*; // // public class Sortsearchassigncodeex1 { // public static void fillArray(Scanner inputFile, int[] arrIn){ int indx = 0; //Complete code { arrIn[indx] = inputFile.nextInt(); indx++; } }arrow_forwardI'm getting this progm to run but vis producing no out put. import java.util.Scanner;import java.lang.Math; public class CarValue { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); Car myCar = new Car(); int userYear = scnr.nextInt(); int userPrice = scnr.nextInt(); int userCurrentYear = scnr.nextInt(); myCar.setModelYear(userYear); myCar.setPurchasePrice(userPrice); myCar.calcCurrentValue(userCurrentYear); myCar.printInfo(); }} the calculations are performed in this prigram. private int currentValue; public void setModelYear(int userYear){ modelYear = userYear; } public int getModelYear() { return modelYear; } // Define setPurchasePrice() method public double setPurchasePrice(int userPrice){ return purchasePrice; } // Define getPurchasePrice() method public double getPurchasePrice(int userPrice){ return purchasePrice; }…arrow_forward
- I have my code here and I am getting errors (I have also attached my code): " import java.util.Compiler; public class Test Score { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Ënter the first exam Score: "); Double Score1 = scan.nextDouble(); System.out.println("Enter the second exam Score: "); Double Score2 = scan.nextDouble(); System.out.println("Enter the third exam Score: "); Double Score3 = scan.nextDouble(); System.out.println("Enter the fourth exam Score: "); Double Score4 = scan.nextDouble(); System.out.println("Enter the fifth exam Score: "); Double Score5 = scan.nextDouble(); Double total = Score1 + Score2 + Score3 + Score4 + Score5 Double average = total/5; if (average >= 90) { System.out.printf("your average was a: %f and recieved an A in this Class", average ); } else if (average >= 80) {…arrow_forward1 import java.util.Scanner; 3 public class TriangleArea { INM&567 000 2 4 8 9 10 11 12 13 14 15 4567890 16 17 18 19 20 21 } public static void main(String[] args) { Scanner scnr = new Scanner(System.in); } Current file: TriangleArea.java = Triangle triangle1 new Triangle(); Triangle triangle2 = new Triangle(); // TODO: Read and set base and height for triangle1 (use setBase() and setHeight()) // TODO: Read and set base and height for triangle2 (use setBase() and setHeight()) System.out.println("Triangle with smaller area:"); // TODO: Determine smaller triangle (use getArea()) // and output smaller triangle's info (use printInfo())arrow_forwardJAVA CODE: check outputarrow_forward
- I have this java code " import java.util.Scanner;public class Main3 {public static void main(String[] args) {// Create Scanner input;Scanner scanner = new Scanner(System.in);boolean Continue = true;while (!Continue) {}// Defining variables with input parametersSystem.out.print("Enter the Loan amount: ");double loanAmount = scanner.nextDouble();System.out.print("Enter the number of years: ");int n = scanner.nextInt();System.out.print("Enter the annual interest rate: ");float a = scanner.nextFloat();// Equations for Variables// Calculate monthly interest ratefloat i = a / 12;// Calculate total monthsint m = n * 12;// Calculate payment monthlyfloat monthlyPayment = (float) ((loanAmount * i * Math.pow(1 + i, n)) / (Math.pow(1 + i, n) - 1));// Calculate Total Paymentfloat totalPayment = monthlyPayment * 12;// Printing the results for VariablesSystem.out.printf("Monthly payment is $%.2f\n", monthlyPayment);System.out.printf("Total payment is $%.2f\n", totalPayment);}}"How do I turn single…arrow_forwardCreate the UML Diagram for this java code import java.util.Scanner; interface Positive{ void Number();} class Square implements Positive{ public void Number() { Scanner in=new Scanner(System.in); System.out.println("Enter a number: "); int a = in.nextInt(); if(a>0) { System.out.println("Positive number"); } else { System.out.println("Negative number"); } System.out.println("\nThe square of " + a +" is " + a*a); System.out.println("\nThe cubic of "+ a + " is "+ a*a*a); }} class Sum implements Positive{ public void Number() { Scanner in = new Scanner(System.in); System.out.println("\nEnter the value for a: "); int a = in.nextInt(); System.out.println("Enter the value for b" ); int b= in.nextInt(); System.out.printf("The Difference of two numbers: %d\n", a-b); System.out.printf("The…arrow_forwardI need help fixing this Java program: import java.util.Scanner; public class TimeConverter { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int totalYears; int numMillennia; int numCenturies; int numYears; totalYears = scnr.nextInt(); /* Your code goes here */ System.out.println("Millennia: " + numMillennia); System.out.println("Centuries: " + numCenturies); System.out.println("Years: " + numYears); } }arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education