c# - No Overload for Method. What am i Doing Wrong? -
no overload method. doing wrong? head alread hurts :)
//this first class named employee namespace lala { public class employee { public static double grosspay(double weeklysales) //grosspay { return weeklysales * .07; } public static double fedtaxpaid(double grosspay) { return grosspay * .18; } public static double retirementpaid(double grosspay) { return grosspay * .1; } public static double socsecpaid(double grosspay) { return grosspay * .06; } public static double totaldeductions(double socsecpaid, double retirementpaid, double fedtaxpaid) { return socsecpaid + retirementpaid + fedtaxpaid; } public static double takehomepay(double grosspay, double totaldeductions) { return grosspay - totaldeductions; } }
}
this second class named employeeapp dont know why program doesnt work
namespace lala { public class employeeapp { public static string name; public static double weeklysales; public static void main() { employee yuki = new employee(); getinfo(); console.writeline(); console.writeline("name: {0}", name); console.writeline(); console.writeline("gross pay : {0}", yuki.grosspay()); console.writeline("federal tax paid : {0}", yuki.fedtaxpaid()); console.writeline("social security paid : {0}", yuki.socsecpaid()); console.writeline("retirement paid : {0}", yuki.retirementpaid()); console.writeline("total deductions : {0}", yuki.totaldeductions()); console.writeline(); console.writeline("take-home pay : {0}", yuki.takehomepay()); console.readkey(); } public static string getinfo() { console.write("enter employee name : "); name = console.readline(); console.write("enter weekly sales : "); weeklysales = convert.todouble(console.readline()); return name; } }
}
any gladly appreciated :)
employee yuki = new employee(); yuki.grosspay();
or rather:
employee.grosspay();
you trying use static methods in wrong way.
Comments
Post a Comment