Question: Create an ArrayList to hold 10 FeetInches objects. Input is from the keyboard (20 ints). To get the correct output you MUST use this input:

Create an ArrayList 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 amd the corect output should go in a txt file called answers.txt

import java.util.Scanner;

public class Lab6Num4 { public static 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 ; } } public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); }

This is the code that is given.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!