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...
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...
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...
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...
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,...
How do I make this: public class Country {     private String name;     private double area;     private...
How do I make this: public class Country {     private String name;     private double area;     private int population;     public Country(String name, double area, int population) {         this.name = name;         this.area = area;         this.population = population;     }     public double getPopulationDensity() {         return population / area;     }     public String getName() {         return name;     }     public void setName(String name) {         this.name = name;     }     public double getArea() {         return area;     }     public void setArea(double area) {         this.area = area;     }     public int getPopulation()...
Complete the // TODO sections in the EasyRental class. Create a method that implements an iterative...
Complete the // TODO sections in the EasyRental class. Create a method that implements an iterative sort that sorts the vehicle rentals by color in ascending order (smallest to largest) Create a method to binary search for a vehicle based on a color, that should return the index where the vehicle was found or -1 You are comparing Strings in an object not integers. Ex. If the input is: brown red white blue black -1 the output is: Enter the...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT