Answered step by step
Verified Expert Solution
Link Copied!

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 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 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Master The Art Of Data Storytelling With Visualizations

Authors: Alexander N Donovan

1st Edition

B0CNMD9QRD, 979-8867864248

More Books

Students also viewed these Databases questions

Question

=+4. Who are credible sources and opinion leaders for this public?

Answered: 1 week ago

Question

Discuss the key people management challenges that Dorian faced.

Answered: 1 week ago

Question

How fast should bidder managers move into the target?

Answered: 1 week ago