Question
Create an array to hold 10 FeetInches objects. Input is from the keyboard (20 ints). To get the correct output you MUST use this input:
Create an array to hold 10 FeetInches objects. Input is from the keyboard (20 ints). To get the correct output you MUST use this input: 56 34 4 67 3 4 45 5 11 21 84 45 44 5 8 11 23 2 20 19 After inputting the data into the array, output it IN REVERSE
import java.util.Scanner;
public class Lab5Num1 {
public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); //create an array to hold 10 FeetInches objects //input 20 ints from the keyboard. //you MUST enter the ones I gave you to get the correct output //AFTER you have created the array, output each element on a new line starting with the last element for(int k=9; k>=0; k--) { } }
public class FeetInches { private int feet; private int inches;
public FeetInches() {//write the code for the default constructor here feet = 0; inches = 0; } public FeetInches(int f, int i) { feet = f + i/12; inches = i%12; } public void setFeet(int f){ feet = f; } public void setInches(int i){ feet = feet + i/12; inches = i%12; } public int getFeet(){ return feet; } public int getInches(){ return inches; }
public String toString() { return " Feet: " + feet + " Inches: " + inches ; } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started