Note that in this problem set you have to write your programs "from scratch", i.e. you are not given any files to start from. Feel free to copy/paste code from the examples given in class, but make sure to keep the class name and the file name consistent. Please write your program in good programming style: choose meaningful names of variables and don't forget comments!
Please enter an integer: 4 Please enter a number: 2.78 The 4th power of 2.78 is 59.728166559999984
Math.powfor the computation. Don't worry if your program prints out things like "The 2th power...", it's fine at this point. Later we will learn how to print different messages depending on values of variables.
Test your program on several different values of inputs. Double-check your computations on a calculator.
Math.PIfor the value of Pi. As in the previous problem, test your program carefully and double-check the computations.
The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.