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

  Explaining steps to execute branch instruction

Sketch a flow chart which carefully explains steps that little man follows to execute a branch instruction.

  Program to print total balances forward and total withdrawal

At the end of report, print total balances forward, total deposits, total interest earned, total withdrawals and total final account balances.

  Implement functions using x86 assembly

Implement a procedure that mimics a logic unit

  Show how the tree might be type-checked

Attempt to derive proof tree for the judgment Show how the tree might be type-checked

  Using the irvine32 library functions

Create 32 random points which have (x, y) co-ordinates

  Determining suitable parameters if pass-by-reference is used

Subprocedures in VBA utilize pass-by-reference. Which function or sub procedure alters its parameter?

  Accuracy and completeness of computations

Analysis right and you have to develop a plausible argument to "prove" that your analysis is correct

  Implementing class called card for standard playing card

Design and implement a aclass called Card that represents a standard playing card. each card has a suit and a face value.

  Hubspot: inbound marketing and web 2.0

Hubspot: Inbound Marketing and Web 2.0

  Recursive method to search a string for a byrd

Write a recursive method that searches a string for a Byrd. A Byrd has the following properties. Its first character is an 'A'. If it is a two character Byrd then its second and last character is an 'H'.

  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.

  Computer sales and repair store system

It is required to design a relational database system for a "realistic" application

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