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

Pages: 1-

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: sage 2011-04-07 19:18

no

Name: Anonymous 2011-04-07 19:20

noko

Name: Anonymous 2011-04-07 19:47

Some people, when confronted with a problem, think ``I know, I'll ask /prog/!''. Now they have FUQIN ANGERED AN EXPERT PROGRAMMER two problems.

Name: Anonymous 2011-04-07 22:14

do this 5 times:

get input
if 10 <= input <= 100:
continue
else go back to start

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()

Name: Anonymous 2011-04-08 1:52

>>6
Seeing |> made me think of the ``in Lisp'' DSL.

Name: Anonymous 2011-04-08 2:26

List.filter
Because obviously filter is such a rarely-needed combinator, especially in a functional programming language, that it needs to sit inside the List module. Fucking disgusting. I can only compare this to Guido's continued fucktardedness as he almost moved map and filter to the functools corner.

Fuck this shit.

Name: GvR 2011-04-08 2:48

>>8
Who needs filter anyway, use a for loop.

Name: Anonymous 2011-04-08 2:54

>>9
Don't expect a raging response. I'm the ``deluded Pythonista'' and I am also >>8.

Name: Anonymous 2011-04-08 2:55

>>10
Sage is unpythonic, use a for loop.

Name: Anonymous 2011-04-08 2:57

>>7
What is this ``in Lisp'' I see frequently on /prog/ everyone puts in ``proper quotes''?

Name: Anonymous 2011-04-08 3:09

Name: >>13 2011-04-08 3:10

You can also see ``him'' (the ``in Lisp'' guy) post some irrelevant shitty code in random threads (like the Post Code one I just bumped, /prog/ needs a Post Code thread on the frontpage)

Name: Anonymous 2011-04-08 3:11

Yeah but who doesn't loop their list operations?

Name: Anonymous 2011-04-08 3:55

>>13
>>14
Thank you.

Name: Anonymous 2011-04-08 3:58

  (define (program)
    (define (input)
      (let loop ([n (read)])
        (if (and (integer? n) (>= n 10) (<= n 100))
            n
            (begin (displayln "Must enter an integer between >= 10 and <= 100")
                   (loop (read))))))
    (define (average l)
      (if (empty? l) 0 (/ (apply + l) (length l))))
    (displayln "Please enter five integers >= 10 and <= 100, separated with an enter.")
    (let loop ([l '()])
      (if (< (length l) 5)
          (loop (cons (input) l))
          (begin
            (display "Number of even numbers: ")
            (let count-loop ([l l]
                             [evens empty])
              (if (empty? l)
                  (begin (displayln (length evens))
                         (display "Average: ")
                         (displayln (exact->inexact (average evens))))
                  (count-loop (cdr l) (if (even? (car l))
                                          (cons (car l) evens)
                                          evens))))))))

Name: >>17 2011-04-08 4:00

Forgive me if it's a bit retarded... I'm still learning.

Name: Anonymous 2011-04-08 4:40

>>17-18
Move things outside of program, abstract the problem away and keep separated side effects from functional code.

Name: Anonymous 2011-04-08 8:03

[]? in my scheme?!

Name: sage 2011-04-08 10:54

>this is my assignment

Name: Anonymous 2011-04-08 15:44

>>21
back to imageboards "faggot"

Name: Anonymous 2011-04-08 19:41

>>8
Because obviously filter is such a rarely-needed combinator, especially in a functional programming language, that it needs to sit inside the List module.

While functools.filter would be retarded, List.filter makes perfect sense because it filters lists.  As opposed to Array.filter which filters arrays.

Name: Anonymous 2011-04-08 20:10

>>23
No it does not. What the fuck.

Name: Nambla_dot_org_rules_you 2011-04-08 20:20

Conceptually, an array and a list are two different things.

Name: Anonymous 2011-04-08 20:33

>>25
HAHAHAHAHAHAHAHHAHAHAHAAHAHAAAA!!!
you think your tough huh?
one word THE FORCED INDENTATION OF CODE.
i have taken out two mission critical applications at the same time in less than 5 seconds i have been training for 3 years.
also enterprise grade best practices.
your compiler might be bigger than me,but i know mine is smarter and quicker.
my compiler is 130 kb pure lean code.
one keystroke and i'll overflow your buffers.
your the one whose a nerd.i can optimize CFLAGS anytime i want you probably haven't ever touched CFLAGS before.
you probably have sex with your computer.
you don't even know me,and you don't want to.
you'll be lucky if your even worth my attention one look at my code and you'll dissappear forever.
though i'd be hapy to humiliate you in front of all your friends.
btw IM the expertest.
i have worked in maine, new hampshire, new york,utah, colorado,florida,bahamas.
never indented my code!
im undefeated in competitive obfuscation of code.
im on my way to IOCCC.
go ahead and come step anytime you want.b*tch

Name: Anonymous 2011-04-08 20:38

>>26
Oh, so you want to track down members of MY chat room?
127.0.0.1
If you win, I'll drop dox on these folks.
If you lose, however, you leave /prog/ forever.
Hack me, you pussy.
Your friends are invited as well, I will be waiting.
proggit, pm me. You know who I am.

Name: nambla_dot_org_rules_you 2011-04-08 20:43

>>26
Let me guess. You didn't take your meds today.

Name: Anonymous 2011-04-08 20:58

>>28
Let me guess. You didn't take it up YOUR ANUS today.

Name: Nambla_dot_org_rules_you 2011-04-08 21:20

>>29
Only because your mom forget her strap on when she came over this afternoon.

Name: Anonymous 2011-04-09 4:47

>>28,30
Let me guess, your father rapes you from when he gets home til when he goes to sleep, no break, not even for tea made by his loving black-eyed wife.

Name: Anonymous 2013-09-01 14:08


Multiplication is non-decreasing in both arguments: κ ≤ μ → (κ·ν ≤ μ·ν and ν·κ ≤ ν·μ).

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