Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Arrays

  1. #1
    Junior Member
    Join Date
    May 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Arrays

    How can I do the work below in Java
    • In this “main class”, create 5 objects of the class Menu, as defined in the table below.
    name amount of calories cooking time price per person number of drinks
    Fufu and Groundnut Soup 564.65 25 15.57 2
    Red Red 345 12 9.98 0
    Rice and Beef Stew 560.4 15 12.65 1
    Ga Kenkey and Fish 780 10 10.15 1
    Banku and Tilapia 450.4 35 25.17 2


    Exercise d
    • In your “main class” create an array of length 5, and store the 5 objects (Exercise c) into the array. You can use any name for your array.
    • From the array, use a loop to:
    o Print the details of all the objects using the method you defined in Exercise b.


    Exercise e
    • Use another loop to:
    o Print only the name and cooking time of all the dishes that take less than 30 minutes to cook. Hint: you may use the getter methods for the name and cooking time attributes, and then, print these values (name, cooking time).

    Exercise f
    • Use another loop to :
    o Calculate and print the total price of all the objects (in the array).
    o Calculate the total price of all the objects with VAT included for each dish (VAT rate is 17.5%).

    Submission
    • Create a folder with your index number as its name.
    • Copy your Java Project folder into the created folder.
    • Print a hard copy of your classes.
    • Submit both soft copy and hard copy of your project by 5th May 2014.


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Arrays

    This isn't a homework service.

    Please read the link in my signature on asking questions the smart way, then try again.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Help with arrays
    By Lasers in forum What's Wrong With My Code?
    Replies: 7
    Last Post: October 23rd, 2013, 11:24 PM
  2. Help with Arrays!
    By le pencil in forum What's Wrong With My Code?
    Replies: 5
    Last Post: April 12th, 2013, 12:05 PM
  3. 2D arrays
    By Fluffy in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 5th, 2012, 05:11 PM
  4. 2d arrays help
    By gonfreecks in forum What's Wrong With My Code?
    Replies: 0
    Last Post: November 27th, 2010, 05:27 PM
  5. arrays
    By dwamalwa in forum Java Theory & Questions
    Replies: 4
    Last Post: November 27th, 2010, 01:44 AM