Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

hey prog can you help me?

Name: Anonymous 2011-04-07 18:44

this is my assignment:

1. Create a flowchart that represents the logic of the following problem:

The program asks the user to input five positive integer numbers, determines and displays the number of the even numbers and the average of these numbers. If the user inputs a number less than 10 or greater than 100, then asks the user to input another number until a valid e number is entered.  When the user enters five numbers, the program stops input and displays the number of the even numbers and the average of  all even input numbers. Use Raptor to create the flowchart and name file lab9. Test your flowchart.

2. Redo the problem 1 using Java. Name the file lab9.java.

i have no idea what to do! i've been working on this for an hour now but so far all i've done is make a loop counter!

i need your help! please

Name: Anonymous 2011-04-08 1:47


open System

let rec getNumbers c =
    if c = 0 then
        []
    else
        let n = float(Console.ReadLine())
        if ( n < 10.) || (n > 100.) then getNumbers(c) else  n :: getNumbers(c - 1)

let main =
    getNumbers(5)
    |> List.filter (fun n -> n % 2. = 0.)
    |> (fun l -> (List.length l, List.average l))

Console.WriteLine(main)
Console.ReadKey()

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List