Ruby program that continuously reads in number

Assignment Help Programming Languages
Reference no: EM1347119

Q1) Write down Ruby program that continuously reads in number, x, from screen, and then calculates and displays its:

i) factorial, if x is less than 15;
ii) fourth power, if 15 < x ≤ 35 and
iii) square, if x > 35.

Your program should run until the user wishes to stop running it. In other words, after processing the first number, it should ask the user if he or she wants to continue. If the answer is no the program terminates; if the answer is yes it reads in another number, processes it and asks the user again until the user says no.

Reference no: EM1347119

Questions Cloud

Explain how will the economy change over time : Explain how will the economy change over time. Explain in words and using an aggregate-demand/aggregate-supply diagram.
Theoretical frameworks : Theoretical Frameworks - Dissertation about Employee Retention; why do employees leave their companies and how can management retain employees
Variable costing-financial reporting : Why is variable costing not allowed for financial reporting purposes?
Solving financial analysis problem : Acme producing is a decentralized company. Sections are treated as investment centers. In recent years, Acme has been running about 11 percent ROA for company as a whole, and has a cost of capital of 9%.
Ruby program that continuously reads in number : Write down Ruby program that continuously reads in number, x, from screen, and then calculates and displays its: factorial, if x is less than 15.
Describe how the concepts from lockes goal : Describe how the concepts from Locke's goal setting theory can be incorporated into Vroom's expectancy theory. Explain how the concepts in Adams' equity theory can be incorporated into expectancy theory.
Illustrate what is the effect on equilibrium price : Illustrate what is the effect on equilibrium price and quantity in the market for oranges if a new orange picking machine is developed.
Stanley works costing system : Stanley Works is one of the companies you looked at in the job-order costing vs. process costing. Which type of costing do you think that company uses, process costing or job-order costing?
Jamestown textiles process costing : Calculate the total work done in equivalent units and the unit cost for April. Calculate the cost of units completed and transferred. Also, compute the costs in ending work in process.

Reviews

Write a Review

Programming Languages Questions & Answers

  Procedure to draw shape of choice

Write a program with a suitable procedure to draw shape of your choice. Your program must then call the procedure 10 times to draw the shape.

  Writing code in client program to enter score

Write down code in a client program to perform the following: prompt user to enter score and set score data member for player1.

  Development of the current strategic potential of airline

Evaluate the organisation's current external and internal strategic position

  Explaining variable in an arrays of ints

Assume that variable A is an arrays of ints. Consider the following code segment.

  Program that prompts user to enter five test scores

Write the algorithm for a program that prompts the user to enter five test scores.

  Examine the boxplot

Examine the boxplot and briefly discuss the overall pattern of electricity usage for the households.

  Designing system to handle donations of non-profit agency

You have been hired by worldwide non-profit agency to create a system to handle their donations.

  Write pseudocode

Write pseudocode that represents the abstract functions of the enqueue and dequeue operations. Define and explain any supplementary information needed by your pseudocode.

  Program to compute perimeter and area of rectangle

Write a program that asks for length L and the width W of a rectangle, then compute perimeter and area of the rectangle.

  Javascript for metric conversions

Write a javascript that will assist the user with metric conversions. Your program should allow the user to specify the names of the units as strings.

  Explaining object hierarchy in object-oriented programming

Study the concept of inheritance and the object hierarchy in object-oriented programming, and write a paper comparing these concepts with the concept of inheritence.

  Learn redirecting standard output

Learn redirecting standard output (stdout) to a file using the output redirection operator

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd