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 02
The code provided below contains syntax and/or 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 DebugCustomer(int id, name, double creditLimit)
{
idNumber = id;
name = name;
creditLimit = credit;
}
public void display()
{
System.out.println("Customer # + idNumber +
" Name: "+ name, "
Credit limit $"+ creditLimit);
}
}
public class DebugCustomerMakingPurchase extends DebugCustomer
{
private double amountOfPurchase;
private boolean overLimit;
public DebugCustomerMakingPurchase(int id,
String name, double credit, double purchAmount)
{
amountOfPurchase = purchAmount;
if(amountOfPurchase > creditLimit)
overLimit = true;
else
overLimit = true;
}
@Override
public void display()
{
this.display();
System.out.println("Purchase amount $"+ amountOfPurchase);
if(overLimit);
System.out.println("****Credit denied - customer over limit");
else
System.out.println("Purchase Okay");
}
}
// A customer's purchase is approved if the
// purchase does not exceed the credit limit
public class DebuggingExercise02
{
public static void main(String args[])
{
int id =12241;
String name = "Franklin";
double credit =1000.00;
double purchase =1325.77;
DebugCustomerMakingPurchase cust =
DebugCustomerMakingPurchase(id, 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!