Question: Java code will not run. Help! My code is posted below. The error I'm getting is no public class found to execute, but I made

Java code will not run. Help! My code is posted below. The error I'm getting is "no public class found to execute", but I made sure my main class is public and I've never had this issue before and I cannot figure it out.

class DeliveryOrder CustomerAccount{

String item;

double quantity;

double totalPrice;

String accntID;

String 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 void SetItem(String item){

this.item=item;

}

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=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=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){

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();

}

}

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!