Quantcast

Maximum PC

It is currently Mon Sep 01, 2014 1:06 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Programming help
PostPosted: Fri Oct 15, 2010 6:49 pm 
8086
8086

Joined: Sun Apr 11, 2010 12:59 am
Posts: 68
Hey guys,
I am in a computer systems technology course right now... but we only just started using eclipse and I am so lost.. I have written small programs such as the HelloWorld program. I was away from school for 1.5 weeks with mono and have so much to catch up on! My professors do not offer help/review sessions. This is soo hard to learn without being in those classes I missed :( This program is quite a bit more complicated. Can you guys give me a hand with the lines of code involved as per the following instructions? Thank you so much in advance! :)

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
When the Titanic embarked on her maiden voyage on April 10, 1912 there were 2,227 people on board. There were also only 20 lifeboats with an average capacity of about 59 people (maximum capacity was therefore about 20 x 59 = 1,180 people). Obviously it would have been ideal to have enough lifeboats to safely evacuate everyone on board ship! Your task is to write a Java program that will calculate the minimum number of lifeboats required to do this as well as the numbers of people who would be rescued or drowned given the number of available lifeboats. Your program should be flexible enough to work for any ship and size of lifeboat.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Write a Java program called Lifeboats.java that will do all of the following:
1. Display a title


2. Ask the user to enter the following values:
a. The name of the ship (possibly including spaces like HMS Endurance)
b. The number of people on board the ship
c. The maximum number of people that can be carried by one lifeboat assuming all the lifeboats on the ship are the same size
d. The actual number of lifeboats that are available on board the ship

3. Calculate and display the following results:
a. The minimum number of lifeboats required to carry all the people
b. The number of people that would be rescued if the available lifeboats were filled (but not beyond the number of people on board the ship) as well as the percentage that this represents of all the people on board
c. The number of people that would drown as well as the percentage that this represents of all the people on board
d. If nobody drowns, then also display the number of additional people that could be carried by the lifeboats if they were all filled to capacity regardless of whether this number is greater than the number of people on board.


Top
  Profile  
 
 Post subject: Re: Programming help
PostPosted: Sat Oct 16, 2010 8:19 am 
Team Member Top 100
Team Member Top 100

Joined: Sun Feb 12, 2006 2:52 pm
Posts: 1994
Location: Cryptogram City!
I don't know a thing about Java, but this assignment has three parts:

1) get data from the user,

2) make simple arithmetic computations (ie: the number of people who would drown equals the number of people on board, minus the number of people who could (in total), be put into life boats.), and

3) output a few variables.

Check your book or Google for what you don't know about #1 and #3. If you're stuck on #2, specify what you're stuck on.

This is an easy assignment - not climbing Mr. Everest here. 8)


Top
  Profile  
 
 Post subject: Re: Programming help
PostPosted: Sat Oct 16, 2010 9:04 am 
Java Junkie
Java Junkie
User avatar

Joined: Mon Jun 14, 2004 10:23 am
Posts: 24222
Location: Granite Heaven
We don't do homework here.

We will help you with code you've written but we won't write the assignment for you.


Top
  Profile  
 
 Post subject: Re: Programming help
PostPosted: Sun Oct 17, 2010 1:03 am 
8086
8086

Joined: Sun Apr 11, 2010 12:59 am
Posts: 68
I apologize for not showing my first code writes. Here they are.
And for future referance, I am not looking for someone to do my homework. How can I learn this language if someone does it all for me? I just need someone to help guide me. It was my bad for not being more clear with my current work in progress. Here is what I have so far.

import java.util.Scanner;

public class Lifeboats

{
public static void main(String [] args)

{
Scanner userInput = new Scanner(System.in);
System.out.println("\n\n\t\t\tLifeboat Capacity Analysis!");
System.out.println("\t\t\t***************************************\n\n");

System.out.println("First some information is needed...");

System.out.print("Please enter the ship name... ");
String shipName = userInput.nextLine();
System.out.print("Please enter number of passengers on board... ");
int passengers = userInput.nextInt();
System.out.print("Please enter the maximum capacity per lifeboat");
int lifeboatCap = userInput.nextInt();
System.out.print("Please enter the amount of lifeboats available on the " + shipName);
int lifeboatAmount = userInput.nextInt();

double amount =


Top
  Profile  
 
 Post subject: Re: Programming help
PostPosted: Sun Oct 17, 2010 5:33 am 
Northwood
Northwood
User avatar

Joined: Mon Sep 17, 2007 1:27 pm
Posts: 3311
Location: Toronto, ON
What is it exactly you are having trouble with? The syntax? Or coming up with the algorithms?


Top
  Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group