Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 results, copy the corrected code and place it here:
Take screenshot of the final output and place it here:
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