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:
/* * 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.print(Commision); myWeek2class.displayMessage(); } }
And the subclass:
/* * 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()); } }