I am not asking you to do my homework. I am legitlly stuck on this and cannot figure out how to fix it. It seems that i cannot get the packages to see each other. Thanks for any Help.
Using Jgrasp
public abstract class Book { private String title; private double price; public abstract void setPrice(); public double getPrice() { return price; } public void setTitle(String bk_title) { title = bk_title; } public String getTitle() { return title; } }
import Book.java; public class Fiction extends Book { Fiction fic = new Fiction(); public void setPrice(double bk_price) { price = bk_price; } fic.getPrice() { return price; } }
public class Nonfiction extends Book { Nonfiction nonfic = new Nonfiction(); nonfic.setPrice(double) { price = 37.99; } nonfic.getPrice() { return price; } }
import Book.java; import Fiction.java; import NonFiction.java; public class UseBook { public static void main(String[]args) { System.out.println("price for fiction: $" + price); System.out.println("price for nonfiction: $" + bk_price); } }
Here are the errors:
UseBook.java:1: error: package Book does not exist
import Book.java;
^
UseBook.java:2: error: package Fiction does not exist
import Fiction.java;
^
UseBook.java:3: error: package NonFiction does not exist
import NonFiction.java;
^
UseBook.java:9: error: cannot find symbol
System.out.println("price for fiction: $" + price);
^
symbol: variable price
location: class UseBook
UseBook.java:10: error: cannot find symbol
System.out.println("price for nonfiction: $" + bk_price);
^
symbol: variable bk_price
location: class UseBook
5 errors
----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.