Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Run BlueJ and create a new BlueJ project in your lab11 folder. Create a new class named JavaAPILabMain in your BlueJ project. Delete the example

Run BlueJ and create a new BlueJ project in your lab11 folder. Create a new class named JavaAPILabMain in your BlueJ project. Delete the example code and start afresh with a new class definition that contains a main method. To confirm everything is ready to go, add a System.out.println call to your main method and have it print out the name of your favorite movie. Then compile and run the program to verify that it works.

Part 1: Explore the Java API

Using the two left-hand frames in the API browser-window, find the String class and display its details in the large frame.

Notice that right above the words Class String are the words java.lang in a smaller font. java.lang is the package in which class String may be found. You already know that often you need to add an import statement to your program to make certain classes available; this is how you find out whether you need an import statement and, if so, which one. As it happens, java.lang is Javas default package: you never need to add an import statement for java.lang, because these classes are always available. If a different package name should appear there, however, you will know that you need to add an import statement to your program if you wish to use that class. You will need to use this fact later in this lab.

Answer the questions below:

1.Jill has two strings s1 and s2 which each contain different email addresses (e.g., ). She wants to know if both addresses are from academic institutions. The easiest way to do this is to see if both addresses end with . Find the best method in the String class for doing this and complete the code Jill should use below:

boolean bothEduAddresses = _________________________________;

2.Paul is writing software to store information about all the card carrying members of his secret club. Each membership card is stamped with a unique ID that contains three sections separated by hyphens. These sections are always four digits, four characters and then eight digits respectively. For example, one ID is 1994-NEPR-48573923.

Find the best method in the String class for comparing two ID strings to see if their second sections match. No other methods in the String class should be necessary. Write a code snippet using that method to compare the 4th and 14th entry in the members array to see if their second sections match.

you can find lab material here :

https://www.dropbox.com/s/vr1z8230jz7bzox/lab11.zip?dl=0

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_2

Step: 3

blur-text-image_3

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

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

More Books

Students also viewed these Databases questions

Question

Describe the three main uses of an income statement.

Answered: 1 week ago

Question

how do hobbes and Locke differ on their views of government?

Answered: 1 week ago