Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Algorithms and Program Structure The following exercises are to be completed dur

ID: 3662483 • Letter: A

Question

Algorithms and Program Structure

The following exercises are to be completed during lab class. If you do not

have time to finish during lab, they must be completed before the

beginning of the following lab session.

Set

-

Up

Create a new project in your Eclipse workspace named:

Lab02

In the

src

folder, create a package named

:

edu.ilstu

.lab02

Import into this new package all of the .java files in the lab0

2

folder in the

T:

it168

Matsuda

Labs folder

.

Problem 1

Create a new Java class named

My

FirstClass

.

Complete

the comment blocks as required for every program. In the

comment block for the class, write

“A first program rearranging

statements

to make it correct

.”

Type in your answer to pre

-

lab question 1.

Run the program and make any

needed corrections.

Be sure the output matches the Expected Output.

Problem 2

Create a new Java class named

CharacterVariables

to check to see

whether your answer to pre

-

lab question

3

is correct.

At first you will just be

t

yping in the program exactly as it is in

Exercise 11

.

C

omplete the comment blocks as required for every program. In the

comment block for the class, write

Working with character data

.”

Type in the program

from pre

-

lab

question 3

, run it, and check the

answer

you predicted in the pre

-

lab.

Once you have that working,

make two changes

by adding 2 new statements

:

o

add another statement and assign character ‘A’ to variable

a

.

o

add another display statement and display the value store in variable

a

.

Problem

3

Following the instructions from Lab 1, import the file

Errors.java

from the

Labs

lab

02 folder into your project.

Add the

appropriate

comment blocks.

2

Correct all of the errors so that the program runs correctly with the following

output:

Hello

-

IT

168 STUDENT

Can you find all the errors in this program?

Sure!

Can you fix them and make the program run correctly?

Yes I can!

Problem 4

Create a new class called

FuelEfficiency

Calculator

. In the

FuelEfficiencyCalculator

class, c

onvert the following

pseudocode to Java

code

:

Store

65

in the

miles

variable.

Store

2

in the

gallon

s

variable.

Divide

miles

by

gallons

and store the result in a variable called

mpg

.

Display the contents of the variable

mpg

.

Note: What would be the appropriate data types for

the variables above?

Add the appropriate comment blocks.

To Be Submitted

The following files should be zipped together into a file called Lab02.zip and

submitted to Reggie

N

et by the beginning of your next lab.

FirstClass.java

CharacterVariables

.java

Errors.java

FuelEfficiency

Calculator

.java

Explanation / Answer

please give full details of your requirment

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote