Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help fix Java code errors please. import java.util.Scanner; class DeliveryOrder{ String item; double quantity; double totalPrice; String accntID; String authnum; public void SetItem(String item){ this.item=;

Help fix Java code errors please.

import java.util.Scanner;

class DeliveryOrder{

String item;

double quantity;

double totalPrice;

String accntID;

String authnum;

public void SetItem(String item){

this.item="";

this.quantity=0.0;

this.totalPrice=0.0;

this.acctID="";

this.authnum="";

}

public DeliveryOrder(String item, double quantity, double totalPrice, String acctID, String authnum){

this.item=item;

this.quantity=quantity;

this.totalPrice=totalPrice;

this.acctID=acctID;

this.authnum=authnum;

}

public String GetItem(){

return item;

}

public void SetQuantity(double quantity){

this.quantity=quantity;

}

public double GetQuantity(){

return quantity;

}

public void SetTotalPrice(double totalPrice){

this.totalPrice=totalPrice;

}

public double GetTotalPrice(){

return totalPrice;

}

public void SetID(String acctID){

this.acctID=acctID;

}

public String GetID(){

return accntID;

}

public void SetAuthnum(String authnum){

this.authnum=authnum;

}

public String GetAuthnum(){

return authnum;

}

public void OrderDetails(){

System.out.println("The item is: "+this.GetItem());

System.out.println("The quantity is: "+this.GetQuantity());

System.out.println("The totalPrice is: $"+this.GetTotalPrice());

System.out.println("The account ID is: "+this.GetID());

System.out.println("The authorization number is: "+this.GetAuthnum());

}

}

class CustomerAccount extends DeliveryOrder{

public CustomerAccount(String acctID){

super(acctID);

}

}

class CustomerInterface extends DeliveryOrder{

public CustomerInterface(String item, double quantity, double totalPrice, String acctID){

super(item);

super(quantity);

super(totalPrice);

super(acctID);

}

}

class BankInterface{

public String cardnum;

public BankInterface(String cardnum){

this.cardnum=cardnum;

}

public void SetCardnum(String cardnum){

this.cardnum="";

}

public String GetCardnum(){

return cardnum;

}

}

class Email{

public String custemail;

public Email(String custemail){

this.custemail=custemail;

}

public void SetEmail(String custemail){

this.custemail="";

}

public String GetEmail(){

return custemail;

}

}

class OrderManager extends DeliveryOrder{

public OrderManager(String item, double quantity, double totalPrice, String acctID){

super(item);

super(quantity);

super(totalPrice);

super(acctID);

}

}

public class TestOrder{

public static void main(String[] args){

Scanner input=new Scanner(System.in);

System.out.println("Please enter your card number.");

cardnum=input.next();

if(cardum=="12345678"){

System.out.println("Order approved.");

DeliveryOrder order1=new DeliveryOrder("Note", 3, 20, "Alex", "3333");

DeliveryOrder order2=new DeliveryOrder("Book", 1, 50, "John", "5555");

DeliveryOrder order3=new DeliveryOrder("Pencil", 20, 10, "Sam", "7777");

order1.OrderDetails();

order2.OrderDetails();

order3.OrderDetails();

}

else{

System.out.println("Not a valid card number.");

}

}

}

image text in transcribed

/TestOrder.java:17: error: cannot find symbol this.acctID-"" symbol: variable acctI /Testorder.java:24: error: cannot find symbol this.acctID-acctID; symbol: variable acctID /Testorder.java:46: error: cannot find symbol this.acctID-acctID; symbol: variable acctID /Testorder.java:7: error: constructor Deliveryorder in class Deliveryorder cannot be applied to given types; super (acctID); required: String, double,double,String,string found: String reason: actual and formal argument lists differ in length /Testorder.java:77: error: constructor Deliveryorder in class DeliveryOrder cannot be applied to given types; super(item); required: String, double,double,String,String found: String reason: actual and formal argument lists differ in length /TestOrder.java:78: error: call to super must be first statement in constructor super (quantity); /TestOrder.java:79: error: call to super must be first statement in constructor super (totalPrice); /Testorder.java:80: error: call to super must be first statement in constructor super (acctID); /Testorder.java: 114: error: constructor Deliveryorder in class Deliveryorder cannot be applied to given types; super(item); required: String, double,double,String,string found: String reason: actual and formal argument lists differ in length /Testorder.java:115: error: call to super must be first statement in constructor super (quantity); /Testorder.java:116: error: call to super must be first statement in constructor super (totalPrice); /TestOrder.java:117: error: call to super must be first statement in constructor super (acctID); /TestOrder.java:125: error: cannot find symbol cardnum-input.next(); symbol: location: class TestOrder variable cardnum /Testorder.java:126: error: cannot find symbol if(cardum"12345678" symbol variable cardum location: class Testorder 14 errors

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

Relational Database Design A Practical Approach

Authors: Marilyn Campbell

1st Edition

1587193175, 978-1587193170

More Books

Students also viewed these Databases questions

Question

6. Discuss the steps involved in conducting a task analysis.

Answered: 1 week ago