Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: need help with the coding kinda da loss

  1. #1
    Junior Member
    Join Date
    Jun 2017
    Posts
    8
    My Mood
    Worried
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default need help with the coding kinda da loss

     
    package task1;
    import java.util.*;
     
    class Task1
    {	
     
    	double billpay;
     int x,n;
     
     
             double temp [] = new double [4];
             double rate = 0;
             double test = 0;
     
    	void Bill(long units)
    	{
      	   if (usage [x] <=60)
              {rate =usage [x] *2.00;
              System.out.println("Total Customer Bills : \t" + "$" + rate+"\n\n");}
     
               if (usage [x] >=60)
              {rate =60*1.75 + ((usage [x] -60)*1.50);
              System.out.println("Total Customer Bills : \t" + "$" + rate+"\n\n");}
     
              temp [x] = rate;
     
             }
     
     
     
             }	 
     
     
     
     
    class GASBill extends Task1
    { 
            public static void main(String args[]) 
            {   
    	    long units;
     
    	    Scanner sc=new Scanner(System.in);
     
    	    System.out.println("enter number of units");
     
                      units=sc.nextLong();
     
                GASBill b=new GASBill();
                b.Bill(units);
     
          	    System.out.println("Bill to pay : " + b.billpay); 
       } 
    }

    hi guys i need help with the coding it give out this error
    Error: Main method not found in class task1.Task1, please define the main method as:
    public static void main(String[] args)
    or a JavaFX application class must extend javafx.application.Application
    right now iam abit confusing with the coding..

  2. #2
    Member
    Join Date
    May 2017
    Location
    Eastern Florida
    Posts
    68
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Default Re: need help with the coding kinda da loss

    Error: Main method not found in class task1.Task1,
    What command did you execute to get that error message?

    There is no main() method in the Task1 class.
    The main() method is in the GASBill class.
    Is GASBill in a package? If not, To execute that class use the command: java GASBill
    Otherwise include the full package name in the java command: java <thepackagename>.GASBill
    be sure to be in <thepackagename> folder when executing that command

  3. #3
    Junior Member
    Join Date
    Jun 2017
    Posts
    8
    My Mood
    Worried
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: need help with the coding kinda da loss

     
    package task1;
    import java.util.*;
     
    class Task1
    {	
     
    	double billpay;
     int x,n;
     
     
             double temp [] = new double [4];
             double rate = 0;
             double test = 0;
     
    	void Bill(long units)
    	{
      	   if (usage [x] <=60)
              {rate =usage [x] *2.00;
              System.out.println("Total Customer Bills : \t" + "$" + rate+"\n\n");}
     
               if (usage [x] >=60)
              {rate =60*1.75 + ((usage [x] -60)*1.50);
              System.out.println("Total Customer Bills : \t" + "$" + rate+"\n\n");}
     
              temp [x] = rate;
     
             }
     
     
     
             }	 
     
     
     
     
    class TASK1 extends Task1
    { 
            public static void main(String args[]) 
            {   
    	    long units;
     
    	    Scanner sc=new Scanner(System.in);
     
    	    System.out.println("enter number of units");
     
                      units=sc.nextLong();
     
                Task1 b=new Task1();
                b.Bill(units);
     
          	    System.out.println("Bill to pay : " + b.billpay); 
       } 
    }

    is it related the packet name?
    Error: Could not find or load main class task1.Task1
    i change it but giveout the error and advice.

  4. #4
    Member
    Join Date
    May 2017
    Location
    Eastern Florida
    Posts
    68
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Default Re: need help with the coding kinda da loss

    Error: Could not find or load main class task1.Task1
    What command is being executed to get that error message?

    If you are using an IDE, perhaps you should try using the command prompt first to learn what is going on.

    Take a look at the tutorial. Pick your OS and see the example of how a HelloWorld program can be compiled and executed.

    I don't use an IDE and can not help you configure the one you are using.

  5. #5
    Junior Member
    Join Date
    Jun 2017
    Posts
    8
    My Mood
    Worried
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: need help with the coding kinda da loss

    for now we using the netbeans

  6. #6
    Member
    Join Date
    May 2017
    Location
    Eastern Florida
    Posts
    68
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Default Re: need help with the coding kinda da loss

    Sorry, I don't know anything about netbeans.

Similar Threads

  1. Replies: 5
    Last Post: August 19th, 2014, 03:30 AM
  2. Project help, kinda lost
    By OpX316 in forum Java Theory & Questions
    Replies: 1
    Last Post: November 20th, 2011, 09:10 AM
  3. Kinda different question
    By crazed8s in forum AWT / Java Swing
    Replies: 0
    Last Post: December 5th, 2010, 02:13 PM
  4. I'm looking for some getting started kinda help
    By Matress in forum Member Introductions
    Replies: 2
    Last Post: April 14th, 2010, 10:58 AM
  5. help: union of two array,.. kinda problem
    By sanfor in forum Collections and Generics
    Replies: 2
    Last Post: November 29th, 2009, 02:33 PM