Guys I need help with these exercises please if you can help me!
1. Flights. You have a table of flights that shows the flight number and the number of passengers.
You are only responsible for the flights with more than 100 passengers. To have a visualization
of the number of passengers you are responsible for, you want to print a star “*” for every 10
passengers (rounding up). Also print the flight number.
For example, if you have two flights, LH102 with 138 passengers and AZ399 with 101, the
output should look as the following:
LH102: **************
AZ399: ***********
Remember, you will not consider any flight that has 100 or less passengers.
2. Numbers. Write an algorithm that takes n numbers from the user and then prints the count
of positive numbers, the count of negative numbers and the count of zeros.
3. Average. Write an algorithm that takes n numbers and a threshold and then prints the average
of all numbers greater than the threshold (ignoring those numbers which are equal to or below
threshold).
Challenging algorithms!
Started by exonerated, Apr 26 2010 11:55 PM
4 replies to this topic
#1
Posted 26 April 2010 - 11:55 PM
|
|
|
#2
Posted 27 April 2010 - 04:24 AM
What have you tried so far? Please show your code.
#3
Posted 27 April 2010 - 08:12 AM
*Sniff* *Sniff* Smells suspiciously like homework. We all know what that means...
While( !User.hasAnswer )
{
User.askQuestion();
if( User.postCode && User.putForthEffort )
{
CodeCallMembers.Help();
User.hasAnswer = true;
}
else
{
CodeCallMembers.Laugh();
}
}
-CDG10620
Software Developer
Software Developer
#4
Posted 27 April 2010 - 09:31 AM
#5
Posted 27 April 2010 - 09:32 AM
No no, the challenging problems are at Project Euler


Sign In
Create Account

Back to top









