Question

<<<<<<<< I need only the UML diagram for ALL classes.Java???????????? public class House {    private...

<<<<<<<< I need only the UML diagram for ALL classes.Java????????????

public class House

{

   private int houseNumber;

   private int bedrooms;

   private int sqFeet;

   private int year;

   private int cost;

   public House(int houseNumber,int bedrooms,int sqFeet, int year, int cost)

   {

       this.houseNumber = houseNumber;

       this.bedrooms = bedrooms;

       this.sqFeet = sqFeet;

       this.year = year;

       this.cost = cost;

   }

   public int getHouseNumber()

   {

       return houseNumber;

   }

   public int getBedrooms()

   {

       return bedrooms;

   }

   public int getSqFeet()

   {

       return sqFeet;

   }

   public int getYear()

   {

       return year;

   }

   public int getCost()

   {

       return cost;

   }

   public boolean isExpensive()

   {

       if(cost>300)

           return true;

       return

           false;

   }

   public boolean isNew()

   {

       if(year>=2000)

           return true;

       return

           false;

   }

   public String toString()

   {

       return "HouseNumber: " + houseNumber + ", Bedrooms: " + bedrooms + ",SqFeet: " + sqFeet + ",Year:" + year +", Cost:" + cost +"\n";

   }

}

*/

import java.util.ArrayList;

public class HouseComplex

{

   public String toString(House[] list, int n)

   {

       if(n==0)

           return "";

       return toString(list, n-1) + list[n-1];

   }

   public void printExpensiveHouses(House[] list, int n)

   {

       if(n==0)

           return;

       printExpensiveHouses(list, n-1);

       if(list[n-1].isNew())

           System.out.print(list[n-1]);

   }

   public int countNew(House[] list, int n)

   {

       if(n==0)

           return 0;

       if(list[n-1].isNew())

           return 1 + countNew(list, n-1);

       return countNew(list, n-1);

   }

   private House min(House h1, House h2)

   {

       if(h1.getCost()>h2.getCost())

           return h2;

       return h1;

   }

   public House newestHouse(House[] list, int n)

   {

       if(n==1)

           return list[0];

       return min(list[n-1], newestHouse(list, n-1));

   }

   public ArrayList moderateSize(House[] list, int n)

   {

       ArrayList alist = new ArrayList();

       if(n==0)

           return alist;

       if(list[n-1].getSqFeet()>=1000 && list[n-1].getSqFeet()<=2000)

       {

           alist.add(list[n-1]);

       }

       return moderateSize(list, n-1);

   }

}

/**

* Write a description of class HouseCompex here.

*

*/

import java.io.*;

import java.util.*;

public class Tester

{

   public static void main(String []args) throws IOException

   {

       Scanner sc = new Scanner(new File("inData.txt"));

       House[] houseList = new House[100];

       int houseNumber, bedrooms, sqFeet, year, cost, i;

       for(i=0; sc.hasNext();i++)

       {

           houseNumber = sc.nextInt();

           if(sc.hasNext()==false) break;

           bedrooms = sc.nextInt();

           sqFeet = sc.nextInt();

           year = sc.nextInt();

           cost = sc.nextInt();

           houseList[i] = new House(houseNumber, bedrooms, sqFeet, year, cost);

       }

       HouseComplex hc = new HouseComplex();

       System.out.println("Print all houses in the list:");

       System.out.println(hc.toString(houseList, i));

       System.out.println("Print all expensive houses in the list:");

       hc.printExpensiveHouses(houseList, i);

       System.out.println("\nPrint number of new houses in the list:");

       System.out.println(hc.countNew(houseList, i));

       System.out.println("Print the newest house in the list.:");

       System.out.println(hc.newestHouse(houseList, i));

   }

}

Homework Answers

Answer #1

Note : Please comment below if you have concerns. I am here to help you

If you like my answer please rate and help me it is very Imp for me

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Provide A UML for the Following CODE public class Employee{ public String strName, strSalary; public Employee(){...
Provide A UML for the Following CODE public class Employee{ public String strName, strSalary; public Employee(){    strName = " ";    strSalary = "$0";    } public Employee(String Name, String Salary){    strName = Name;    strSalary = Salary;    } public void setName(String Name){    strName = Name;    } public void setSalary(String Salary){    strSalary = Salary;    } public String getName(){    return strName;    } public String getSalary(){    return strSalary;    } public String...
in java need uml diagram import java.util.ArrayList; import java.util.*; public class TodoList { String date=""; String...
in java need uml diagram import java.util.ArrayList; import java.util.*; public class TodoList { String date=""; String work=""; boolean completed=false; boolean important=false; public TodoList(String a,String b,boolean c,boolean d){ this.date=a; this.work=b; this.completed=c; this.important=d; } public boolean isCompleted(){ return this.completed; } public boolean isImportant(){ return this.important; } public String getDate(){ return this.date; } public String getTask(){ return this.work; } } class Main{ public static void main(String[] args) { ArrayList<TodoList> t1=new ArrayList<TodoList>(); TodoList t2=null; Scanner s=new Scanner(System.in); int a; String b="",c=""; boolean d,e; char...
Which method is correct to access the value of count? public class Person { private String...
Which method is correct to access the value of count? public class Person { private String name; private int age; private static int count = 0; } A. private int getCount() {return (static)count;} B. public static int getCount() {return count;} C. public int getCount() {return static count;} D. private static int getCount() {return count;} How can you print the value of count? public class Person { private String name; private int age; private static int count=0; public Person(String a, int...
please fix code to delete by studentname import java.util.Scanner; public class COurseCom666 {     private String...
please fix code to delete by studentname import java.util.Scanner; public class COurseCom666 {     private String courseName;     private String[] students = new String[1];     private int numberOfStudents;     public COurseCom666(String courseName) {         this.courseName = courseName;     }     public String[] getStudents() {         return students;     }     public int getNumberOfStudents() {         return numberOfStudents;     }     public void addStudent(String student) {         if (numberOfStudents == students.length) {             String[] a = new String[students.length + 1];            ...
Please solve this problem in java. import java.util.Arrays; public class PriorityQueue { /* This class is...
Please solve this problem in java. import java.util.Arrays; public class PriorityQueue { /* This class is finished for you. */ private static class Customer implements Comparable { private double donation; public Customer(double donation) { this.donation = donation; } public double getDonation() { return donation; } public void donate(double amount) { donation += amount; } public int compareTo(Customer other) { double diff = donation - other.donation; if (diff < 0) { return -1; } else if (diff > 0) { return...
[Java] I'm not sure how to implement the code. Please check my code at the bottom....
[Java] I'm not sure how to implement the code. Please check my code at the bottom. In this problem you will write several static methods to work with arrays and ArrayLists. Remember that a static method does not work on the instance variables of the class. All the data needed is provided in the parameters. Call the class Util. Notice how the methods are invoked in UtilTester. public static int min(int[] array) gets the minimum value in the array public...
Q: Implement an equals method for the ADT list that returns true when the entries in...
Q: Implement an equals method for the ADT list that returns true when the entries in one list equal the entries in a second list. In particular, add this method to the class AList. The following is the method header: public boolean equals (Object other) public class AList<T>{ private T list[]; private int capacity = 100; private int numOfEnteries =0; public AList(){ list = (T[])new Object[capacity + 1]; } public void add(T element){ numOfEnteries++; if (numOfEnteries >capacity) System.out.println ("Exceed limit");...
This is the java code that I have, but i cannot get the output that I...
This is the java code that I have, but i cannot get the output that I want out of it. i want my output to print the full String Form i stead of just the first letter, and and also print what character is at the specific index instead of leaving it empty. and at the end for Replaced String i want to print both string form one and two with the replaced letters instead if just printing the first...
How do I get this portion of my List Iterator code to work? This is a...
How do I get this portion of my List Iterator code to work? This is a portion of the code in the AddressBookApp that I need to work. Currently it stops at Person not found and if it makes it to the else it gives me this Exception in thread "main" java.lang.NullPointerException    at AddressBookApp.main(AddressBookApp.java:36) iter.reset(); Person findPerson = iter.findLastname("Duck"); if (findPerson == null) System.out.println("Person not found."); else findPerson.displayEntry(); findPerson = iter.findLastname("Duck"); if (findPerson == null) { System.out.println("Person not found.");...
The AssemblyLine class has a potential problem. Since the only way you can remove an object...
The AssemblyLine class has a potential problem. Since the only way you can remove an object from the AssemblyLine array is when the insert method returns an object from the last element of the AssemblyLine's encapsulated array, what about those ManufacturedProduct objects that are "left hanging" in the array because they never got to the last element position? How do we get them out? So I need to edit my project. Here is my AssemblyLine class: import java.util.Random; public class...