CSC 190 Lecture Notes - Lecture 11: Lead
Document Summary
//purpose: find the maximum number import java. util. scanner; public class p0204a { public static void main(string[] args) { Scanner in = new scanner(system. in); int n1, n2, n3, n4, n5; //input int max; //output. //max2 - 2-way if if (n1 > n2) //>, >=, max) //1-way if max = n2; if (n3 > max) max = n3; if (n4 > max) max = n4; if (n5 > max) max = n5; System. out. print("enter your hourly rate: "); rate = in. nextdouble(); //purpose: wage and tip import java. util. scanner; public class pb { public static void main(string[] args) { //wage for part-timer double rate, hours; double wage; System. out. println("you earned: "+wage+" dollars this week. rate = in. nextdouble(); System. out. print("enter hours worked: "); hours = in. nextdouble(); if (hours <= 40) wage = rate*hours; else wage = 40*rate + (hours-40)*1. 5*rate;