assignment1

Type the following code into a file called TempConverter.java. After the program is entered, compile
and run the application to make sure it works. Once you see it working correctly, answer questions a-e
below. (The comment block shown here is a good example to base yours off of for Part 2, Program #2,
namely Assignment1.java). You DO NOT have to submit this file.
//***********************************************************
// Name: Faye Navabi
// Title: TempConverter.java
// Author: (if not you) Modified from an example in Lewis &
// Loftus book
// Lab Letter and your TA’s name:
// Description: Computes the Fahrenheit equivalent of a specific Celsius
// value
// Time spent: 20 minutes
// Date: 8/20/11
//**************************************************************
public class TempConverter
{
// Computes the Fahrenheit equivalent of a specific Celsius
// value using the formula F = (9/5)C + 32.
public static void main (String[] args)
{
//constant variables
There are numerous opportunities for errors in any program, many times in places that seem too simple to
require close attention.
Questions: Introduce the following errors, one at a time, in the program TempConverter.java. Write in
your own words any error messages that the compiler produces. Fix the previous error each time
before you introduce a new one. If no error messages are produced, try to run the code and explain what
happens. If still no errors are produced, explain why.
a. Change TempConverter to tempConverter.
b. Remove the first quotation mark in the first string literal in the first
System.out.println( ) statement.
c. Remove the semicolon at the end of the first println ( ) statement.
d. Remove the last brace in the program.
e. Change the variable name fahrenheitTemp to fahrenheit in any one place in the code.
Write a Java program called Assignment1.java, which prints your first name, last name, your
status (freshman, sophomore...), your major, your favorite subject at school, your favorite book,
the high school you graduated from, favorite hobby, favorite ice cream flavor, and etc
Make sure to use the following: You have to use all of the following to get full credit.
 The print and println methods.
 Several string literals.
 Escape sequences, for example \n, or \t, \* or etc (need to use at least two)
 The string concatenation (+) operator for two strings.
 Comments.
Powered by