private void btn_calc_kfa_Click(object sender, EventArgs e) { try { double stomach = Convert.ToDouble(tB_stomach.Text); double neck = Convert.ToDouble(tB_neck.Text); double height = Convert.ToDouble(tB_height.Text); double waist = Convert.ToDouble(tB_waist.Text); if (rB_male.Checked) { double kfa = Cl_Athlete.calc_kfa(stomach, neck, height); MessageBox.Show("Digga, dein KFA liegt bei " + kfa + " %!"); } else if (rB_female.Checked) { double kfa = Cl_Athlete.calc_kfa(stomach, neck, height, waist); MessageBox.Show("Diggi, dein KFA liegt bei " + kfa + " %!"); } } catch { MessageBox.Show("Es sind nicht alle Felder ausgefüllt!"); } }
//------------------------------------------------------------------------------------------------------------------------- // Constructors------------------------------------------------------------------------------------------------------------ public Cl_Athlete(string nickname, string email, string sex, double weight, double height, DateTime birthday) { this.nickname = nickname; this.email = email; this.sex = sex; this.weight = weight; this.height = height; this.birthday = birthday; this.age = Cl_Athlete.calc_age(birthday); }
public Cl_Athlete(string nickname, string email, string sex, DateTime birthday, double weight, double height, double ffm, double ffmi, double kfa) { this.nickname = nickname; this.email = email; this.sex = sex; this.birthday = birthday; this.age = Cl_Athlete.calc_age(birthday); this.weight = weight; this.height = height; this.ffm = ffm; this.ffmi = ffmi; this.kfa = kfa; }
//------------------------------------------------------------------------------------------------------------------------- // Static Methods and Functions---------------------------------------------------------------------------------------------- public static Cl_MacroPlanner calc_macro(int kcal, Cl_Athlete athlete) { double weight = athlete.Weight; int protein = Convert.ToInt32(weight * 2); int fat = Convert.ToInt32(weight * 0.8); int carbohydrates = Convert.ToInt32((kcal - (protein * 4) - (fat * 9)) / 4); Cl_MacroPlanner macros = new Cl_MacroPlanner(kcal, protein, fat, carbohydrates); return(macros); }
private void button2_Click(object sender, EventArgs e) { Cl_MacroPlanner Daniel = new Cl_MacroPlanner(); // Hier das gleiche Thema wie oben ;) Cl_Athlete Me = new Cl_Athlete("Daniel10S", "*****@*****.**", "male", 78, 175, mC_birthdate.SelectionRange.Start); // Hier auch das gleiche Thema und me ist ein geschützter Begriff, aber das konnteste nicht wissen :) // Haste den Athleten zum üben instanziiert? :) Daniel.Kcal = Cl_MacroPlanner.calc_kcal(190, 40, 360); MessageBox.Show("Du solltest " + Daniel.Kcal + " kcal pro Tag zu dir nehmen."); }
public static double calc_kcal(Cl_ActivityCalculator activity, Cl_Athlete athlete) { double result; if (athlete.Sex == "male") { result = ((66.47 + (13.7 * athlete.Weight + 5 * athlete.Height - 6.8 * athlete.Age)) * activity.Job_factor) + activity.Sport_kcal + activity.Goal_kcal; } else { result = ((655.1 + (9.6 * athlete.Weight + 1.8 * athlete.Height - 4.7 * athlete.Age)) * activity.Job_factor) + activity.Sport_kcal + activity.Goal_kcal; } return(result); }
private void button1_Click_2(object sender, EventArgs e) { Cl_Athlete Daniel = new Cl_Athlete("DanielS", "*****@*****.**", "male", 78, 175, mC_birthdate.SelectionRange.Start); Cl_ActivityCalculator activity = new Cl_ActivityCalculator(); activity.Goal_kcal = Cl_ActivityCalculator.calc_goal_calories(0.5); activity.Job_factor = Cl_ActivityCalculator.get_job_factor("normal"); activity.Sport_kcal = Cl_ActivityCalculator.get_sport_calories(Daniel, 60, 3, "power lifting"); Daniel.Kfa = Cl_Athlete.calc_kfa(100, 78, Daniel.Height); Daniel.Bizeps_left = 34; Daniel.Bizeps_right = 33.5; Daniel.Butt = 98; Daniel.Calf_left = 39; Daniel.Calf_right = 38; Daniel.Chest = 98; Daniel.Ffm = Cl_Athlete.calc_ffm(Daniel.Weight, Daniel.Kfa); Daniel.Ffmi = Cl_Athlete.calc_ffmi(Daniel.Height, Daniel.Ffm); Daniel.Kcal = Convert.ToInt32(Cl_Athlete.calc_kcal(activity, Daniel)); Daniel.Lat = 100; Daniel.Quad_left = 88; Daniel.Quad_right = 87.5; Daniel.Shoulders = 105; Daniel.Stomach = 100; Daniel.Waist = 90; Daniel.Neck = 77; MessageBox.Show("Meine Daten sind wie folgt: \n" + Daniel.Kfa + "\n" + Daniel.Ffm + "\n" + Daniel.Ffmi + "\n" + Daniel.Kcal); }
public static double get_sport_calories(Cl_Athlete athlete, int min, int days, string sport_activity) { double sport_factor = 0; switch (sport_activity) { case "soccer": sport_factor = 0.127; break; case "running": sport_factor = 0.15; break; case "biking": sport_factor = 0.07; break; case "swimming": sport_factor = 0.146; break; case "walking": sport_factor = 0.06; break; case "power lifting": sport_factor = 0.11; break; } double result; double weight = athlete.Weight; result = (sport_factor * weight * min * days) / 7; return(result); }
private void btn_calc_age_Click(object sender, EventArgs e) { int age = Cl_Athlete.calc_age(mC_birthdate.SelectionRange.Start); MessageBox.Show("Digga, du biste " + age + " Jahre alt!"); }