Accessing user created variables for an array in a separate class Java (for homework) -
i super new java (4 days) , have never coded except sql databases , simple java script before. building sales commission calculator special policy adjusts amount of commission made based on annual sales amount tier system (<=96,000, >96,000<=120,000 , >120,000).
i have completed. . .what need way use second class(a second class required ) create array takes output or input to/from user , shows user potential money he/she have made if or sales @ "x" in increments of 5,000 50% of user input total sales. here code have far: (i know systemouttest class in bad form sorry)
/** * * @author wudkong */ import java.util.scanner; public class systemouttest { potentialwagechart potentialwagechart; public systemouttest(potentialwagechart potentialwagechart) { this.potentialwagechart = potentialwagechart; } /** * @param args * command line arguments */ public static void main(string[] args) { // main method mathematics scanner input; // determines method scanner input = new scanner(system.in); // creates instance of scanner int salary; // creates variables used later int totalsales; double commissionpercent; double totalpay; double commission; salary = 50000; // defines variable specific value annual // salary system.out.print("enter annual sales amount please: "); /** * asks user amount sold year */ totalsales = input.nextint(); /** * creates dialogue box user enter annual sales amount */ commissionpercent = .15; // defines received total sales data if (totalsales <= 120000 * .8) { commissionpercent = 0; } else if (totalsales > 120000) { commissionpercent = .1875; ; } else commissionpercent = .15; { commission = totalsales * commissionpercent; /** * uses user defined data , commission percentage create * value total commission amount */ totalpay = commission + salary; // adds totals system.out.printf("total annual pay %.2f ", totalpay); /** * uses output stream report user of result of * method 2 decimal places showing. */ } } }
i start next class here willing take advice on anything. know code sloppy , not know best way next part. think can build array constant object not object needs acquired user first. not know how make classes communicate in best way. tried creating reference second class in first class , vice-versa without array or object reference in place can't test links. here appreciated! don't know if get/set method can work or if need reference output instead of user input create array output plus 5,000 , new potential wage on side x spaces. . ?
Comments
Post a Comment