a08f2 - CS1MD3 08f2.1 Assignment 2 Due Oct 14(Tuesday 23:59...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS1MD3 08f2. 1 Assignment 2 Due . Oct. 14 (Tuesday), 23:59. 1. Write a program that asks the user for the radius of a circle and then computes the area of that circle ( A ) using the formula A = πr 2 Note that there is no “raise to power” operator in Java. Given the arithmetic operators you know Java has, how can you write an expression that achieves the desired result? 2. Write a program FahrenheitToCelsius.java that reads in a temperature in degrees Fahren- heit and returns the corresponding temperature in degrees Celsius. The conversion formula is C = 5 9 ( F - 32) The following is a sample run of the program: This program converts Fahrenheit to Celsius. Enter Fahrenheit temperature: 212 Celsius equivalent = 100.0 If you write the program carelessly, the answer always comes out 0. What bug causes this behavior? 3. Write a dialog version of the above program and call it FToCDialog.java . The following is a dialog version of the console program Add2Integers.java (Figure 2-2, page 30). As you
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

a08f2 - CS1MD3 08f2.1 Assignment 2 Due Oct 14(Tuesday 23:59...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online