Question: Debugging Exercise 0 2 The code provided below contains syntax and / or logic errors. In each case, determine and fix the problem, remove all
Debugging Exercise
The code provided below contains syntax andor logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly.
Code:
public class DebugCustomer
protected int idNumber;
protected String name;
protected double creditLimit;
public DebugCustomerint id name, double creditLimit
idNumber id;
name name;
creditLimit credit;
public void display
System.out.printlnCustomer # idNumber
Name: name,
Credit limit $ creditLimit;
public class DebugCustomerMakingPurchase extends DebugCustomer
private double amountOfPurchase;
private boolean overLimit;
public DebugCustomerMakingPurchaseint id
String name, double credit, double purchAmount
amountOfPurchase purchAmount;
ifamountOfPurchase creditLimit
overLimit true;
else
overLimit true;
@Override
public void display
this.display;
System.out.printlnPurchase amount $ amountOfPurchase;
ifoverLimit;
System.out.printlnCredit denied customer over limit;
else
System.out.printlnPurchase Okay";
A customer's purchase is approved if the
purchase does not exceed the credit limit
public class DebuggingExercise
public static void mainString args
int id ;
String name "Franklin";
double credit ;
double purchase ;
DebugCustomerMakingPurchase cust
DebugCustomerMakingPurchaseid name, credit, purchase;
cust.display;
Expected output:
Write your Java code in Eclipse IDE. Once you are happy with your resu
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
