Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Errors.Java public class Errors { public static void double FtoC ( double fahrenheit ) { int celsius = ( fahrenheit + 3 0 ) *

Errors.Java
public class Errors {
public static void double FtoC (double fahrenheit){
int celsius =(fahrenheit +30)*5/9;
double roundingOff = Math.round(celsius*100);
double finalAnswer = roundingOff/100;
return finalAnswer
public static void main(String[] args){
System.out.println("Fahrenheit to Celsius converter:")
int degreesFahrenheit =54.3;
double degreesCelsius = FtoC(degrees);
System.out.println(degreesFahrenheit +"\deg F ="+ degreesCelsius +"\deg C");
}
}
// Once you've corrected all the errors, the answer should be 12.39\deg C
Compulsory Task 1
Follow these steps:
Open the Java file Errors.java.
Attempt to compile the program. Youll notice the compilation will fail due
to some errors. Fix all the compilation errors and compile the program
again. Every time you fix an error, add a comment to the line you fixed and
indicate which of the three types of errors it was.
Now run the program. Once again, youll encounter some errors (this time,
runtime errors). Fix these errors and run the program once again to see if
it works.
Now run the program and notice the output. Youll notice that there are
some logical errors in the code. Fix these errors and run the program once
again to see if it now correctly displays what it should.
Compulsory Task 2
Follow the instructions above on how to debug a program using Eclipse.
Create a password authenticator that asks a user to create a password. The
program will ask them to type the password the first time and then ask
them to type it in again to confirm.
The password is deemed unusable if it does not contain a number or the
two inputs dont match.
Every password entered by the user should be written to a text file.
Print out whether the password has been created or not. If it has not been
created, specify what the user needs to fix and ask the user to try again.
Use defensive programming to write this program in a manner that is
robust and handles unexpected events and user inputs.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

b. Compute the variance. Pg45

Answered: 1 week ago