# Project #84651 - Intro to Programming w/ Java Homework #1

CSC 1011                                          Java programming         Fall2015

Programming Assignment #1

1.Swapping *:

The following pseudocode describes a simple algorithm which swaps the values in two variables, x and y:

1  print “Enter initial value of x: ”

2  input x

3  print “Enter initial value of y: ”

4  input y

5  set temp to x

6  set x to y

7  set y to temp

8  print x = x, y = y

a)    Trace the above pseudocode for x input of 8 and y input of 3, using the following header:

Use a separate row for each line of pseudocode.

b)    Write a Java Program that implements this algorithm.

2.     Circle Parameters *:

Write a Java program that generates and prints circle-related values. Read in a value for radius. Calculate and print the corresponding values for diameter, circumference, and area. Use the built-in Java constant Math.PI for the value of π. Use Math.PI the same way that you would use 3.1452 in your program – there’s no need to declare Math.PI with a declaration statement, just use it.

Sample session:

Diameter = 5.0

Circumference = 15.707963267948966

Area = 19.634954084936208

 Subject Computer Due By (Pacific Time) 10/01/2015 12:00 am
TutorRating
pallavi

Chat Now!

out of 1971 reviews
amosmm

Chat Now!

out of 766 reviews
PhyzKyd

Chat Now!

out of 1164 reviews
rajdeep77

Chat Now!

out of 721 reviews
sctys

Chat Now!

out of 1600 reviews

Chat Now!

out of 770 reviews
topnotcher

Chat Now!

out of 766 reviews
XXXIAO

Chat Now!

out of 680 reviews