CSC 190 Lecture Notes - Lecture 14: Multiple Dispatch

8 views3 pages

Document Summary

//purpose: setting multi-methods import java. util. scanner; public class p0213 static double getavg(double h, double m1, double m2, double f) { double avg; //hw(0-240), m1(0-80), m2(0-100), f(0-200) avg = h/2. 4*0. 4 + m1/0. 8*0. 15 + m2*0. 2 + f/2*0. 25; return avg; static char getgrade(double avg) { //on proper tabbing static void abouttab() { int x = 0; int y = 0; int z = 0; if (x == 1) y = 1; z = 1; //mistabbed. System. out. println(z); //1 x = 0; y = 0; z = 0; if (x == 1) if (y == 1) z = 1; else //mistabbed if (y == 1) z = 2; else z = 3; System. out. println(z); //1 x = 0; y = 0; z = 0; if (x == 1) if (y == 1) z = 1; else if (y == 1) z = 2; else z = 3;

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents