BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//American Young Coder - ECPv6.10.1.1//NONSGML v1.0//EN
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-ORIGINAL-URL:https://www.ayclogic.com
X-WR-CALDESC:Events for American Young Coder
REFRESH-INTERVAL;VALUE=DURATION:PT1H
X-Robots-Tag:noindex
X-PUBLISHED-TTL:PT1H
BEGIN:VTIMEZONE
TZID:America/Los_Angeles
BEGIN:DAYLIGHT
TZOFFSETFROM:-0800
TZOFFSETTO:-0700
TZNAME:PDT
DTSTART:20200308T100000
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:-0700
TZOFFSETTO:-0800
TZNAME:PST
DTSTART:20201101T090000
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTART;TZID=America/Los_Angeles:20200404T150000
DTEND;TZID=America/Los_Angeles:20200404T160000
DTSTAMP:20260430T015841
CREATED:20200408T043744Z
LAST-MODIFIED:20200408T052452Z
UID:3235-1586012400-1586016000@www.ayclogic.com
SUMMARY:3 PM - Intro To Java
DESCRIPTION:We enhanced the “Vehicle” class from homework page 108.\n\nWe added “fuelLeft” variable inside the “Vehicle” class.\nWe added “drive” method with “distance” parameter.\nWe added “getDistanceLeft” method.\n\n\nHomework:\n\n\n\nEnhance the “Vehicle” class with the following\n\nAdd “addMoreFuel” method with one parameter “fuel” whose data type is “int”:\n\n\n\n\n\nInside the method\, it will add parameter “fuel” into “fuelLeft” variable.\nIf “fuelLeft” is more than “fuelCap” the program will do the following\n\nprint “Fuel overflow. Capping fuel tank to “+fuelCap to the shell.\nSet “fuelLeft” to “fuelCap”.\n\n\nAt the end of the method\, print the following 2 pieces of information:\n\n“Your gas tank now has  “+fuelLeft+” gallons”\n“You can drive for “+(fuelLeft*mpg)+” miles.”\n\n\n\n\n\n\n\n\nInside the existing “drive” method\, change the code to do the following\n\nBefore reducing “fuelLeft”\, calculate the distance the vehicle can cover with the “fuelLeft”.\nint distanceItCanGo = fuelLeft * mpg.\n\nif the “fuelLeft” variable is less than or equal to 0\, do the following:\n\nprint to the shell: “Out of gas at “+distanceItCanGo+” miles\, add more fuel please.”\nset the “fuelLeft” variable to 0.\nGet input from shell.\n\n“How many gallons of fuel you want to add? “\nAfter the user enters some number\, call the addMoreFuel method and pass whatever the user enters as the parameter.\n\n\n\n\n\n\n\n\nCreate a new class April4_HomeworkVehicleAddMoreFuel\n\nInside the class create the usual “public static void main(String[] args)” method\nGet input from the shell the following 4 information\n\n“Enter a new vehicle passenger capacity? “\n“Enter a new vehicle fuelCap? “\n“Enter a new vehicle mpg? “\n“How far you want to drive? “\n\n\nAfter getting these 4 pieces of information\, create a new Vehicle\, “april4Vehicle”. Use the first 3 input from the shells as parameters of the Vehicle constructor.\nCall april4Vehicle.drive method and pass 4th input as the method parameter.\n\n\nRun April4_HomeworkVehicleClass\n\nFor vehicle passenger capacity\, enter 4.\nFor vehicle fuelCap\, enter 10.\nFor vehicle mpg\, enter 20.\nFor how far you want to drive\, enter 1000.\nThe program now should print to the shell: “Out of gas\, fill up fuel\, please.”\nThe program will get input from the user “How many gallons of fuel you want to add?”. Enter 20.\nThe program will now print “Fuel overflow. Capping fuel tank to 10.”\nIf the program runs properly\, it should do the following to the shell:\n\n\nEnter a new vehicle passenger capacity? 4\nEnter a new vehicle fuelCap? 10\nEnter a new vehicle mpg? 20\nHow far you want to drive? 1000\nOut of gas at 200 miles\, add more fuel please.\nHow many gallons of fuel you want to add? 100\nFuel overflow. Capping fuel tank to 10.\nYour gas tank now has 10 gallons.\nYou can drive for 200 miles.
URL:https://www.ayclogic.com/event/3-pm-intro-to-java-2/
CATEGORIES:Introduction To Java
END:VEVENT
END:VCALENDAR