markjrubin
Golden Member
I'm having a kooky problem compiling a very simple class and driver class. I have two classes, ShareYourThings.java and DVD.java. DVD.java is part of the package com.markjrubin.syt. When compiling ShareYourThings.java, not DVD.java , I get the error:
C:\java\syt>javac ShareYourThings.java
ShareYourThings.java:4: package com.markjrubin.syt does not exist
import com.markjrubin.syt.*;
I then get errors when trying to create new DVD objects. I have included the source for both file below.
---------------------
// ShareYourThings.java
import java.util.*;
import com.markjrubin.syt.*;
public class ShareYourThings {
static void prt (String s) {
System.out.println(s);
}
public static void main (String [] args)
{
DVD markjrubin1 = new DVD("markjrubin","Fleetwood Mac: The Dance"," "," ",1,20.99,false,false);
DVD farbio2 = new DVD("farbio","Any Given Sunday"," "," ",2,29.99,false,false);
DVD markjrubin3 = new DVD("markjrubin","American Beauty","Academy Award Winner"," ",3,20.99,false,false);
}
}
--------------------
-------------------
// DVD.java
package com.markjrubin.syt;
import java.util.*;
import java.text.*;
public class DVD {
protected String Username,Title,Comments,WhoHasItNow;
protected int DVDID;
protected double Value;
protected boolean isAvailable, isPrivate;
public DVD(String U, String T, String C, String W, int D, double V, boolean iA, boolean iP) {
Username = U;
Title = T;
Comments = C;
WhoHasItNow = W;
DVDID = D;
Value = V;
isAvailable = iA;
isPrivate = iP;
System.out.println("User: " + U + " has added a new DVD"😉;
}
public void printPrice()
{
NumberFormat nf;
nf = NumberFormat.getNumberInstance();
nf.setMaximumFractionDigits(2);
nf.setMinimumFractionDigits(2);
System.out.print("Value:$" + nf.format(Value));
}
public String getTitle()
{
return Title;
}
}
-------------------
Any help would be appreciated. I'm sure I'm just doing something stupid.
C:\java\syt>javac ShareYourThings.java
ShareYourThings.java:4: package com.markjrubin.syt does not exist
import com.markjrubin.syt.*;
I then get errors when trying to create new DVD objects. I have included the source for both file below.
---------------------
// ShareYourThings.java
import java.util.*;
import com.markjrubin.syt.*;
public class ShareYourThings {
static void prt (String s) {
System.out.println(s);
}
public static void main (String [] args)
{
DVD markjrubin1 = new DVD("markjrubin","Fleetwood Mac: The Dance"," "," ",1,20.99,false,false);
DVD farbio2 = new DVD("farbio","Any Given Sunday"," "," ",2,29.99,false,false);
DVD markjrubin3 = new DVD("markjrubin","American Beauty","Academy Award Winner"," ",3,20.99,false,false);
}
}
--------------------
-------------------
// DVD.java
package com.markjrubin.syt;
import java.util.*;
import java.text.*;
public class DVD {
protected String Username,Title,Comments,WhoHasItNow;
protected int DVDID;
protected double Value;
protected boolean isAvailable, isPrivate;
public DVD(String U, String T, String C, String W, int D, double V, boolean iA, boolean iP) {
Username = U;
Title = T;
Comments = C;
WhoHasItNow = W;
DVDID = D;
Value = V;
isAvailable = iA;
isPrivate = iP;
System.out.println("User: " + U + " has added a new DVD"😉;
}
public void printPrice()
{
NumberFormat nf;
nf = NumberFormat.getNumberInstance();
nf.setMaximumFractionDigits(2);
nf.setMinimumFractionDigits(2);
System.out.print("Value:$" + nf.format(Value));
}
public String getTitle()
{
return Title;
}
}
-------------------
Any help would be appreciated. I'm sure I'm just doing something stupid.