sorry it didnt come out properly

Recommended Answers

All 5 Replies

My name Guru,
Could you tell me your code

My name Guru,
Could you tell me your code

the one for my bank account? didn't think so.
otherwise, what code are you requesting in this thread?

if it's free java code you're after, you might first want to check the forum rules, before you get the feeling that people are rude towards you

this is my code am not sure whats wrong with it its not printing the name,how much,the hour in/out,the minute in/out and not letting me do anything just says this and its supposed t obe in java

java.lang.NoClassDefFoundError: PublicGarage
Exception in thread "main" 
 ----jGRASP wedge2: exit code for process is 1.
 ----jGRASP: operation complete.


import java.util.Scanner;
public class PublicGarage
{
public static void main(String [] main)
{
char repeat;                                             //To hold Y,y,N,v,C,c,V,v
double hour = 0.0;                                       //To hold hours between 0-23
double minute = 0.0;                                     //To hold minutes between 0-59
double cost = 0.0;
String customerName;                                      //To hold input

Scanner keyboard=new Scanner(System.in);

System.out.printf("Type of vehicle? C for Car, V for Van");
choice=keyboard.nextcharAt(0);

System.out.printf("Enter arrival hour(0-23)");
scanf("%2d", hour_in);

System.out.printf("\nEnter arrival minute(0-59)");
scanf("%d", minute_in);

System.out.printf("\nEnter exit hour(0-23)");
scanf("%2d", hour_out);

System.out.printf("\nEnter exit minute(0-59)");
scanf("%d", minute_out);

System.out.println("************");
customerName=FullName("NameGarage");
System.out.println(customerName);
System.out.println("************");

System.out.println("Your charge is" + cost);

double totalTime = ( hour * 60.0 ) + minute;

if( type.equals("van"))
{ 
if( totalTime >= 514 ) // more than 8.57 hours 
cost = 30.0;
else if( totalTime < 514 && totalTime > 0)
cost = 3.50 * totalTime;                  // 3.50 per hour 
}

if( type.equals("car"))
{
if( totalTime >= 600)                     // more than 10 hours 
cost = 20.0;
else if( totalTime < 600 && totalTime > 0)
cost = 2.00 * totalTime;                  // 2.00 per hour 
}

System.out.println("Enter y for a new customer or N to stop");
string=keyboard.nextLine(); 
choice=keyboard.charAt(0);
while(choice=='Y' || choice=='y')

}
}

Is that code in a file called "PublicGarage.java"? This is just a class path issue or a file naming issue.

Try compiling your program with "-classpath" keyword.
e.g.

javac -classpath <classpath> PublicGarage.java
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.