Results 1 to 2 of 2
  1. #1
    neowolf is offline Member
    Join Date
    Jun 2012
    Posts
    3
    Rep Power
    0

    Default Pleas anyone can help me?

    Hi all,
    I need help in this i have a mail class and a varable called commision( commision is calculated value). i need move this value to another class to print it. but i no have the form.
    Main class code:
    Java Code:
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    
    /**
     *
     * @author Neowolf
     */
    import java.util.Scanner;
    public class Week2 {
    
        /**
         * @param args the command line arguments
         *
         */
        double link;
        public double showInfo()
        {
               	   return link;
       	}    
        public static void main(String[] args) {
            // TODO code application logic here
            Week2class myWeek2class = new Week2class();//call the class Week2class
            Scanner input = new Scanner(System.in);//create the input variable from the Scanner
            int AnnualSales;//declare variables
            int Salary;
            double Commision;
            
            // Validate the input is a integer and a positive value
            do {
            System.out.println("Please enter a Annual Sales");
            while (!input.hasNextInt()) {
                System.out.println("That's not a valid value!");
                input.next(); // this is important!
            }
            AnnualSales = input.nextInt();
        } while (AnnualSales <= 0);
     // Validate the input is a integer and a positive value           
         do {
            System.out.println("Please enter a Salary");
            while (!input.hasNextInt()) {
                System.out.println("That's not a valid value!");
               input.next(); // this is important!
            }
            Salary = input.nextInt();
        } while (Salary <= 0);
                Commision = Salary + (AnnualSales * .08);
                System.out.println(Commision);
                        myWeek2class.displayMessage();
        }
    }
    And this is the second class:
    Java Code:
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    
    /**
     *
     * @author Neowolf
     */
    public class Week2class {
      public void displayMessage()
      {
       
        Week2 Commision = new Week2();
       System.out.print("Commision and Salary Total is $");
            System.out.println(Commision.showInfo());   
      }
    }
    Thanks

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,875
    Rep Power
    25

    Default Re: Pleas anyone can help me?

    Also posted at: Help with a varibles!
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Data extraction, pleas help!!
    By bob nash in forum New To Java
    Replies: 1
    Last Post: 05-04-2011, 09:09 AM
  2. Java Calculator Square Root Pleas Help
    By TommyR in forum Advanced Java
    Replies: 6
    Last Post: 02-03-2011, 04:28 PM
  3. Pleas help me
    By Smile in forum Java Applets
    Replies: 2
    Last Post: 04-23-2010, 02:18 PM
  4. New here, pleas help!
    By prairie_hoops in forum New To Java
    Replies: 4
    Last Post: 10-29-2009, 08:33 AM
  5. Pleas help on finding errors
    By McXxT in forum New To Java
    Replies: 6
    Last Post: 04-02-2009, 09:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •