
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Class: INTRO TO COMPUTER PROGRAMMING; Subject: Computer Science; University: University of Pittsburgh; Term: Fall 2005;
Typology: Assignments
1 / 1
This page cannot be seen from the preview
Don't miss anything!

Program 1 CS 0007 autumn 2005 Due: Tuesday, September 27, 2005 Write a Java program that will ask the user to enter a set of seven values from keyboard using the methods of the tio class. The values are to be read entered into variables of various data types that are in the following list.
The user will enter a value between 30 and 100 for each of the first six numbers. Enter the same value for each of the first six variables. For example, for the first time the program executes the input command, enter the value 50 for each of these six numeric variables. Next, after the values have been read, the program will print out the value of all six numeric variables. Next the program will execute a loop 10 times and within the loop your program will change the value of each variable to be twice as large as it currently is. So the program must multiply the current value of the variable by 2 and set the value of the variable to this new value for each pass through the loop. The new value of each variable along with a message describing the type will be printed out for each pass through the loop. An example is: The int value is = 50 The short value is = 50 The byte value is = 50 The long value is = 50 The float …. < and it keeps going for float and double> The int value is = 100 <the second time through the loop all 6 values are printed> . . Execute the program at least six times and observe the values printed. Does each value double for the variable for each pass through the loop? Alter the input values for each of the six runs, input a value of 80 and later 100. Your program must contain comments with your name, and program assignment number. You need to copy the source file into the "handin" directory: /afs/cs.pitt.edu/public/incoming/CS0007/fall2005c/hw1/ Instructions how to do this are on the webpage: http://www.cs.pitt.edu/~michal/hp/ta2061-0007.php