Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2012
    Posts
    1
    Rep Power
    0

    Question Can anyone help me on this problem..(i'm a beginner so i don't know much about java )

    My instructor wants me to create a program ..here is the problem:

    Design a Fruit class and its sub classes,Apple,orange,Banana,Strawberry.
    Every fruit has a color.Apple and strawberry are red(no green apple),banana is yellow and the color of an orange is orange.
    You may want to "peel " a fruit.when apple,orange or banana is peeled,.print out a message(like "Peeling a banana").When apple is peeled,its color becomes white.Peeling other fruits have no effect.

    *It first reads from the user how many fruit will be entered.then the fruit are entered using their first letter(Ex: a,b,s,o)
    *print out the color of the fruits(in the same order as they are entered)
    *Print out the number of red colored fruit
    *peel the fruits(in the same order they are entered)
    *print out the number of red fruit again

    Sample Run:
    8
    b
    a
    o
    s
    b
    a
    x
    s
    yellow
    red
    orange
    red
    yellow
    red
    unknown
    red
    There are 4 red colored fruit
    peeling a banana
    peeling an apple
    peeling an orange
    peeling a banana
    peeling an apple
    there are 2 red colored fruits

    ...hope u can help me...i'm not that good yet in java..

  2. #2
    ojn
    ojn is offline Senior Member
    Join Date
    Sep 2008
    Location
    Stockholm, Sweden
    Posts
    119
    Rep Power
    0

    Default Re: Can anyone help me on this problem..(i'm a beginner so i don't know much about ja

    Help you with what? What have you tried and where are you stuck?

    Asking a specific question = good
    Dumping your homework hoping someone will do it for you = bad

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default Re: Can anyone help me on this problem..(i'm a beginner so i don't know much about ja

    Agree: this isn't a question but rather a homework dump and so will be locked. Original poster, if you truly need our help in the future, please show your work and ask a specific question. Don't just simply dump your assignment in here and walk away.

Similar Threads

  1. Beginner Java Problem
    By nighteagle2 in forum New To Java
    Replies: 2
    Last Post: 02-16-2012, 05:35 AM
  2. Beginner Java Problem (Running Objects)
    By marcwilliamson_ in forum New To Java
    Replies: 4
    Last Post: 04-24-2011, 06:45 AM
  3. Beginner Java Modding Problem...
    By walkineagle in forum New To Java
    Replies: 3
    Last Post: 04-13-2011, 05:20 AM
  4. Beginner Problem
    By Freakzoyd in forum New To Java
    Replies: 6
    Last Post: 07-20-2010, 02:23 PM
  5. Beginner's Problem on Loop/If statement
    By obdi in forum New To Java
    Replies: 2
    Last Post: 07-07-2008, 02:41 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
  •