Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Object Oriented Programming I - Quiz 2 | CMSC 131, Quizzes of Computer Science

Material Type: Quiz; Class: OBJECT-ORIENTED PROG I; Subject: Computer Science; University: University of Maryland; Term: Unknown 1989;

Typology: Quizzes

Pre 2010

Uploaded on 02/13/2009

koofers-user-uvw
koofers-user-uvw 🇺🇸

10 documents

1 / 3

Toggle sidebar

Related documents


Partial preview of the text

Download Object Oriented Programming I - Quiz 2 | CMSC 131 and more Quizzes Computer Science in PDF only on Docsity!

CMSC131 Fall 2004 Quiz #

Name (Print last name followed by first name): Student Id: Section time (10am/11am): TAs:

Write a Java program that determines the product of a range of positive integer values. Your program will read two values representing the lower bound and upper bound of the range, compute the product of integers in the range, and print the result. For example, if the lower bound is 3 and the upper bound is 5, your program will output the product 60 (which is 345). If the lower and upper bounds are equal, the product will just be the lower bound. If the lower bound is greater than the upper bound the product will be 1. Because the product might be large, you should store it in a variable of type “long.” The following restrictions/assumptions apply to this problem:

  • The name of the class you will define is RangeProduct.
  • Use the messages “Enter lower bound” and “Enter upper bound” to read the upper and lower bounds, respectively.
  • Use the message “Range product is ” followed by the computed product to display the result.
  • Input and output operations must be completed using methods associated with JOptionPane.
  • You do not need to provide comments, but you must use meaningful variable names and good indentation.
  • You must write any necessary import statements.
  • Write the program on the next page.

WRITE YOUR PROGRAM ON THIS PAGE.