0% found this document useful (0 votes)
96 views

Oracle Java - 4 - 1 - Practice

The document provides an overview of Java fundamentals and Eclipse IDE concepts. It includes vocabulary definitions for terms like camel case, switch workspace, Java package, Java main method, Java class, and open perspective. It also defines Eclipse edit and view areas. The document includes four Try It/Solve It questions: 1) Create a presentation on Eclipse views, 2) Write code to convert gallons to liters, 3) Modify the code to prompt the user for gallons, and 4) Describe ways to test the gallons to liters conversion program.

Uploaded by

rizqi destasari
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
96 views

Oracle Java - 4 - 1 - Practice

The document provides an overview of Java fundamentals and Eclipse IDE concepts. It includes vocabulary definitions for terms like camel case, switch workspace, Java package, Java main method, Java class, and open perspective. It also defines Eclipse edit and view areas. The document includes four Try It/Solve It questions: 1) Create a presentation on Eclipse views, 2) Write code to convert gallons to liters, 3) Modify the code to prompt the user for gallons, and 4) Describe ways to test the gallons to liters conversion program.

Uploaded by

rizqi destasari
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

RIZQI DESTA SARIG1A016041

Java Fundamentals

Java Fundamentals 4-1: Getting Started with Eclipse Practice Solutions

Vocabulary:
A naming convention to eliminate spaces in a name, but
Camel Case to ease readability with capitalization.

To change the different physical location onto which you


Switch Workspace will store and save your files.

Stored inside a project, a mechanism for organizing Java


Java Package classes into namespaces, or containers.

The method inside a class that runs when the class is


Java Main Method compiled and ran.

A construct that is used as a blueprint to create objects.


Java Class Also a construct in which objects are created.

An option to choose a combination of views and editors.


Open Perspective
Areas within the Eclipse IDE that provide a way to
Eclipse Edit and View navigate a hierarchy of information and allow
Areas modifications to elements.

Try It/Solve It:


1. Create a presentation to highlight five or more Views that may be of interest to a programmer
using Eclipse. Use the help system to learn about the Views available in Eclipse. Work in
teams of two to create and deliver the presentation. The presentation should include the
following:
a. A presentation introduction defining the presentation purpose and the team members.
b. A list of five or more Views in Eclipse that will be highlighted.
c. The reason your team selected the five Views to demonstrate.
d. The process your team went through to choose the five Views.
e. The actual demonstration and description of the components.
f. The presentation summary.
RIZQI DESTA SARIG1A016041
Presentations will vary based on Views selected.
2. The pseudo code for converting gallons to liters was described in the lesson. Write the code
for the program. The program will convert a specific number of gallons to liters and then
display the output.
Sample Solution:

import java.util.Scanner;

public class Converter {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

double gallons = sc.nextDouble();

double liters = gallons*3.785;

System.out.println(gallons+" gallons is equivalent to "+liters+" liters");


}}
3. Modify the code written in step 2 to prompt a user for the number of gallons to compute.
Sample Solution:
import java.util.Scanner;
public class Converter {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("How many gallons do you wish to convert?");
double gallons = sc.nextDouble();
double liters = gallons*3.785;
System.out.println(gallons+" gallons is equivalent to "+liters+" liters");
}
}
4. Describe three ways you can test the program that converts gallons to liters.
Answers will vary. Some answers will include the following:
Use negative numbers , Use numbers with decimals , Enter a character instead of a
num, Enter an extremely large number

You might also like