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
Having error problem with my code. HouseListTester: import java.util.*; //Hard codes the criteria public class HouseListTester...
Having error problem with my code. HouseListTester: import java.util.*; //Hard codes the criteria public class HouseListTester { static HouseList availableHouses; public static void main(String []args) { availableHouses = new HouseList("C:\\Users\\jvs34\\Downloads\\houses.txt"); Criteria c1 = new Criteria(1000, 500000, 100, 5000, 0, 10); Criteria c2 = new Criteria(1000, 100000, 500, 1200, 0, 3); Criteria c3 = new Criteria(100000, 200000, 1000, 2000, 2, 3); Criteria c4 = new Criteria(200000, 300000, 1500, 4000, 3, 6); Criteria c5 = new Criteria(100000, 500000, 2500, 5000, 3, 6);...
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...
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...
Determine how all of your classes are related, and create a complete UML class diagram representing...
Determine how all of your classes are related, and create a complete UML class diagram representing your class structure. Don't forget to include the appropriate relationships between the classes. GameDriver import java.util.Scanner; public class GameDriver { Scanner in = new Scanner(System.in); public static void main(String[] args) { Move move1 = new Move("Vine Whip", "Grass", 45, 1.0f); Move move2 = new Move("Tackle", "Normal", 50, 1.0f); Move move3 = new Move("Take Down", "Normal", 90, 0.85f); Move move4 = new Move("Razor Leaf", "Grass",...
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...
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");...
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...
How do I implement this method BalancedByNodeCount() ? public class BinarySearchTree { private Node root; private...
How do I implement this method BalancedByNodeCount() ? public class BinarySearchTree { private Node root; private boolean isBalancedByNodeCount() { /**************************************************************************** Implement this method and replace the return statement below with your code. * Definition of Balance tree (On page 372 of book): * An unbalanced tree is created when most of the nodes are on one side of the root or the other. ****************************************************************************/    return false; }       public static void main(String args[]) { int[] values1 = {50,...
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];            ...
class Car{ private String make; public Car(String make){ this.make = make; } public String toString(){ return...
class Car{ private String make; public Car(String make){ this.make = make; } public String toString(){ return make; } } class Node<T>{ public T data; public Node next; public Node(T data){ this.data = data; this.next = null; } } public class StackLinkedList<T>{ //Single field of type Node    //to represent the front of the stack //operation push() /* The push operation is equivalent to the inserting a node at the head of the list. */ public void push(T data){ } //operation...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT