ScholarMatic | 24/7 Homework Help

ScholarMatic Will Help You Write Your Essays and Term Papers

Answered » You can buy a ready-made answer or pick a professional tutor to order an original one.

The process of finding the largest value is used frequently in computer applications.

ScholarMatic: Explanation & Answer

Your ready answer from a verified tutor is just a click away for as little as $14.99


  

Click Order Now to get 100% Original Answer Customized to your instructions!

Hi,

I need help completing my Ruby Programming assignment.

The assignment is:

The process of finding the largest value is used frequently in computer applications. For example, a program that determines the winner of a sales contest would input

the number of units sold by each salesperson. The salesperson who sells the most units wins the contest. Make a Ruby application that allows a user to input a series of 10 integers and determines and prints the largest integer. Your program should use at least the following three variables:

a) counter: A counter to count to 10 (i.e., to keep track of how many numbers have been input and to determine when all 10 numbers have been processed).

b) number: The integer most recently input by the user.

c) largest: The largest number found so far.

This is what I have so far:

class Screen

 def cls

   puts (“n” * 25)

   puts “a”

 end

 def pause

    STDIN.gets

 end

end

class Program

 def display_instructions

   Console_Screen.cls

   puts “INSTRUCTIONS:nn”

   puts “Enter 10 numbers for the program to choose the largest

     one.”

   print “Press Enter to continue.”

   Console_Screen.pause

 end

 def get_numbers

   numbers = []

   $counter = 0

   $number = numbers.last

   $largest = numbers.max

     Console_Screen.cls

     print “nPlease enter a number and press Enter. “

     input = STDIN.gets

     input.chop!

    while counter < 10

      print “last number entered is: #{$number} “

      print “The largest number entered is: #{$largest}”

      if counter < 10

        print %Q{Type a number. (Press Enter)nn: }

        input = STDIN.gets

        numbers.push = input

        $counter += 1

      else counter >= 10

        puts “The End.” 

      end

    end

 end

end

________________________

Could you please help me out?

Thank you.

ScholarMatic: Explanation & Answer

Your ready answer from a verified tutor is just a click away for as little as $14.99


  

Click Order Now to get 100% Original Answer Customized to your instructions!

HOME TO CERTIFIED WRITERS

Why Place An Order With Us?

  • Certified Editors
  • 24/7 Customer Support
  • Profesional Research
  • Easy to Use System Interface
  • Student Friendly Pricing

Have a similar question?

PLAGIRAISM FREE PAPERS

All papers we provide are well-researched, properly formatted and cited.

TOP QUALITY

All papers we provide are well-researched, properly formatted and cited.

HIGHLY SECURED

All papers we provide are well-researched, properly formatted and cited.

ScholarMatic: Get Started

Assignment Writing Service

Feel safe and secure when placing an order on our portal!
Fruitful cooperation begins with solid guarantees, and we are professional enough to promise perfect results. Let’s get it started!