Question: Create java code for problem 6 a chapter 4 for Java programs To accompany Programming Logic and Design Jo Ann Smith Im having trouble compiling.
Create java code for problem 6 a chapter 4 for Java programs To accompany Programming Logic and Design Jo Ann Smith
Im having trouble compiling. My code does not recognize any strings or int.
/* Barking Lot Bill calculation and display */
import javax.swing.JOptionPane; //Importing for pretty user input windows
public class BarkingLot //Begin BarkingLot class { public static void main(String args[]) //Begin main method { // variable Declarations String owneridnumberString; String nameString; String breedString; String ageString; String weightString; int myidnumber; int age; int weight; int totalBill; //System welcome System.out.println("Welcome to the Barking Lot. ");
//Getting Input from users owneridnumberString = JOptionPane.ShowInputDialog ("Enter owners ID number"); nameString = JOptionPane.ShowInputDialog ("Enter dogs name"); breedString = JOptionPane.ShowInputDialog ("Enter dogs breed"); ageString = JOptionPane.ShowInputDialog ("Enter dogs age"); weightString = JOptionPane.ShowInputDialog ("Enter dogs weight");
owneridnumber = Integer.parseInt(owneridnumberString); age = Integer.parseInt(ageString); weight = Integer.parseInt(weightString);
// Calculate bill
if( weight < 15 ) totalBill= 55; else if ((weight > 15) && (weight <= 30)) totalBill = 75; else if (( weight > 30) && (weight <=80) ) totalBill = 105; else if ( weight >80) totalBill = 125; // output (print) bill System.out.println (owneridnumber+" "+name+" "+breed+" "+age+" "+weight+" "+totalBill); System.exit(0); //Ending program } //End main method
} //End BarkingLot class
I get the following errors:
BarkingLot.java:31: error: cannot find symbol owneridnumberString = JOptionPane.ShowInputDialog ("Enter owners ID number"); ^ symbol: method ShowInputDialog(String) location: class JOptionPane BarkingLot.java:32: error: cannot find symbol nameString = JOptionPane.ShowInputDialog ("Enter dogs name"); ^ symbol: method ShowInputDialog(String) location: class JOptionPane BarkingLot.java:33: error: cannot find symbol breedString = JOptionPane.ShowInputDialog ("Enter dogs breed"); ^ symbol: method ShowInputDialog(String) location: class JOptionPane BarkingLot.java:34: error: cannot find symbol ageString = JOptionPane.ShowInputDialog ("Enter dogs age"); ^ symbol: method ShowInputDialog(String) location: class JOptionPane BarkingLot.java:35: error: cannot find symbol weightString = JOptionPane.ShowInputDialog ("Enter dogs weight"); ^ symbol: method ShowInputDialog(String) location: class JOptionPane BarkingLot.java:38: error: cannot find symbol owneridnumber = Integer.parseInt(owneridnumberString); ^ symbol: variable owneridnumber location: class BarkingLot BarkingLot.java:59: error: cannot find symbol System.out.println (owneridnumber+" "+name+" "+breed+" "+age+" "+weight+" "+totalBill); ^ symbol: variable owneridnumber location: class BarkingLot BarkingLot.java:59: error: cannot find symbol System.out.println (owneridnumber+" "+name+" "+breed+" "+age+" "+weight+" "+totalBill); ^ symbol: variable name location: class BarkingLot BarkingLot.java:59: error: cannot find symbol System.out.println (owneridnumber+" "+name+" "+breed+" "+age+" "+weight+" "+totalBill); ^ symbol: variable breed location: class BarkingLot 9 errors
----jGRASP wedge2: exit code for process is 1. ----jGRASP: operation complete.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
