MilesPerHour - { distance = dist; hours = hrs; minutes =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
//© A+ Computer Science - www.apluscompsci.com //Name - //Date - //Lab - import java.util.Scanner; import static java.lang.System.*; import static java.lang.Math.*; public class MilesPerHour { private int distance, hours, minutes; private double mph; public MilesPerHour() { setNums(0,0,0); mph=0.0; } public MilesPerHour(int dist, int hrs, int mins) { setNums(dist,hrs,mins); } public void setNums(int dist, int hrs, int mins)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { distance = dist; hours = hrs; minutes = mins; } public void calcMPH() { double s; s = hours*60 + minutes; mph=distance/(s/60); } public void print() { System.out.println(); System.out.println( distance +" miles in "+ hours + " hour and " + minutes + " minutes = " + Math.round(mph) + " MPH "); System.out.println("\n\n"); } }...
View Full Document

Ask a homework question - tutors are online