Results 1 to 2 of 2
  1. #1
    Vin5253 is offline Member
    Join Date
    Feb 2011
    Posts
    1
    Rep Power
    0

    Unhappy How to implement boolen in this arraylist problems?

    Complete the class House and HouseApp below to display


    class House{
    int lotNo;
    String type; //Bungalow, SemiDetached
    double price;

    public House ( int l, String t, double p) { … }
    public int theLotN() { … }
    public String theType(){…}
    public double thePrice() { … }
    public void setPrice(double p) {…}
    }


    public class HouseApp{
    public static void main(String []args){

    // declare two ArrayList named listHouse1 and listHouse2

    int lt;
    String tp;
    double pc;

    // prompt user to insert 4 houses’ information into the ArrayList
    // display the houses’ information using the following format
    //
    // HOUSE IN TAMAN ILMU
    // LOTNO TYPE PRICE
    // ……… ……. ……….



    Use the information below as the program input:

    HOUSES IN TAMAN ILMU

    LotNo Type Price
    10021 Bungalow 500,000.00
    10022 Bungalow 700,000.00
    10023 Semi Detached 450,000.00
    10024 Semi Detached 300,000.00



    Modify the coding to check for the price which is more than RM 450000. If it is fullfill the requirement:

    i. remove it from the ArrayList
    ii. calculate the new price for the house by deducting 30% discount off the original price and insert the house information into another ArrayList.


    Display the houses’ information using the following format:


    // HOUSE IN TAMAN ILMU LESS THAN RM450000
    // LOTNO TYPE PRICE
    // ……… ……. ……….



    // HOUSE IN TAMAN ILMU MORE THAN RM450000
    // LOTNO TYPE NEW PRICE
    // ……… ……. ……….

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

Similar Threads

  1. Replies: 7
    Last Post: 11-22-2010, 01:26 PM
  2. How can I implement an ArrayList in an enum?
    By jamesmorlock in forum New To Java
    Replies: 2
    Last Post: 10-29-2010, 10:54 PM
  3. Problems with a loop calling data from an ArrayList.
    By moriarty in forum New To Java
    Replies: 30
    Last Post: 03-28-2010, 02:00 AM
  4. ArrayList problems
    By komo225 in forum New To Java
    Replies: 4
    Last Post: 02-12-2009, 04:14 AM
  5. [Problems] ArrayList
    By Zuela in forum New To Java
    Replies: 1
    Last Post: 06-16-2008, 11:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •