PRG 421 Entire Course

0 items
PRG 421 Entire Course
PRG 421 Entire Course
$59.99
  • Description

PRG/421

JAVA PROGRAMMING II

 

The Latest Version A+ Study Guide

 

 

PRG 421 Entire Course Link

https://hwsell.com/category/prg-421/

 

 

PRG 421 Week 1 Learning Team: Set Up an FAQ

Resource:

 

“Frequently Asked OWL Questions (FAQs)”

Each week during this course, you will be working with your teammates to create a Java™ FAQ, or frequently asked questions, list with answers. The audience for your Java™ FAQ will be other Java™ students.

 

FAQs are extremely common in business and technology today. They answer important questions in an informal, quick answer format for a variety of audiences, from customers to partners to internal stakeholders.

 

Each week, your team will be assigned Java™-related questions to research and answer in FAQ format. Members of your group will research the answers to each week’s questions and edit each other’s work, so that at the end of the course your team’s FAQs are all answered clearly, economically, and accurately, with no misspellings or punctuation errors.

 

For this week’s Learning Team assignment, review the example FAQ, “Frequently Asked OWL Questions (FAQs),” and notice the following formatting guidelines, all of which are designed to make reading an FAQ easy for online readers:

 

Title appears at top of the FAQ, followed by contributors and “last edited” date

Questions appear bolded and two font sizes larger than answers

A double space appears between each question and answer

Answers appear beneath corresponding questions

Both questions and answers are short, direct, and clear. The text is not meant to impress with fancy words or to be exhaustive; rather, it is written the way one professional might advise a colleague, using second person (“you”) and providing clear, specific definitions, advice, and links to extended definitions or examples where appropriate.

Complete this Learning Team assignment by doing the following as a team:

 

Decide which of your team’s members will be responsible for submitting the team’s collaborative FAQ document each week.

Create a Microsoft® Word document with the title “Java Frequently Asked Questions (FAQ).”

Each group member should add his or her name to a contributor list beneath the FAQ title.

The team member responsible for submitting the team’s work will submit the formatted FAQ document, which will only contain the title and contributor names at this time, to the Assignment Files tab.

 

 

PRG 421 Week 1 Individual: Week One Analyze Assignment

Resource:

 

“Analyzing a Java™ Program Contaiing Abstract and Derived Classes”

The purpose of creating an abstract class is to model an abstract situation.

 

Example:

 

You work for a company that has different types of customers: domestic, international, business partners, individuals, and so on. It well may be useful for you to “abstract out” all the information that is common to all of your customers, such as name, customer number, order history, etc., but also keep track of the information that is specific to different classes of customer. For example, you may want to keep track of additional information for international customers so that you can handle exchange rates and customs-related activities, or you may want to keep track of additional tax-, company-, and department-related information for business customers.

 

Modeling all these customers as one abstract class (“Customer”) from which many specialized customer classes derive or inherit (“InternationalCustomer,” “BusinessCustomer,”  etc.) will allow you to define all of that information your customers have in common and put it in the “Customer” class, and when you derive your specialized customer classes from the abstract Customer class you will be able to reuse all of those abstract data/methods.This approach reduces the coding you have to do which, in turn, reduces the probability of errors you will make. It also allows you, as a programmer, to reduce the cost of producing and maintaining the program.

 

In this assignment, you will analyze Java™ code that declares one abstract class and derives three concrete classes from that one abstract class. You will read through the code and predict the output of the program.

 

Read through the linked Java™ code carefully.

 

Predict the result of running the Java™ code. Writeyour prediction into a Microsoft® Word document, focusing specifically on what text you think will appear on the console after running the Java™ code.

 

In the same Word document, answer the following question:

 

Why would a programmer choose to define a method in an abstract class, such as the Animal constructor method or the getName() method in the linked code example, as opposed to defining a method as abstract, such as the makeSound() method in the linked example?

Submit your Word document to the Assignment Files tab.

 

 

PRG 421 Week 1 Individual: Week One Coding Assignment

Resources:

 

“Lesson: Object-Oriented Programming Concepts” on The Java™ Tutorials website

Downloadable starter code from the Oracle® website: Bicyle class and BicycleDemo class

For this assignment, you will modify existing code to create a single Java™ program named BicycleDemo.java that incorporates the following:

 

An abstract Bicycle class that contains private data relevant to all types of bicycles (cadence, speed, and gear) in addition to one new static variable: bicycleCount. The private data must be made visible via public getter and setter methods; the static variable must be set/manipulated in the Bicycle constructor and made visible via a public getter method.

Two concrete classes named MountainBike and RoadBike, both of which derive from the abstract Bicycle class and both of which add their own class-specific data and getter/setter methods.

Read through the “Lesson: Object-Oriented Programming Concepts” on The Java™ Tutorials website.

 

Download the linked Bicycle class, or cut-and-paste it at the top of a new Java™ project named BicycleDemo.

 

Download the linked BicycleDemo class, or cut-and-paste it beneath the Bicycle class in the BicycleDemo.java file.

 

Optionally, review this week’s Individual “Week One Analyze Assignment,” to refresh your understanding of how to code derived classes.

 

Adapt the Bicycle class by cutting and pasting the class into the NetBeans editor and completing the following:

 

Change the Bicycle class to be an abstract class.

Add a private variable of type integer named bicycleCount, and initialize this variable to 0.

Change the Bicycle constructor to add 1 to the bicycleCount each time a new object of type Bicycle is created.

Add a public getter method to return the current value of bicycleCount.

Derive two classes from Bicycle: MountainBike and RoadBike. To the MountainBike class, add the private variables tireTread (String) and mountainRating (int). To the RoadBike class, add the private variable maximumMPH (int).

Using the NetBeans editor, adapt the BicycleDemo class as follows:

 

Create two instances each of MountainBike and RoadBike.

Display the value of bicycleCount on the console.

Comment each line of code you add to explain what you added and why. Be sure to include a header comment that includes the name of the program, your name, PRG/421, and the date.

 

Rename your JAVA file to have a .txt file extension.

 

Submit your TXT file to the Assignment Files tab.

 

 

PRG 421 Week 2 Learning Team: Java I/O FAQ

The purpose of this activity is to define and explain the syntax required for data output.

 

Continue working as a team on your FAQ document by answering the following questions and adding them to the Microsoft® Word document you started in your Week One Learning Team assignment, “Set Up a FAQ”:

 

What is the syntax for writing data to a file?

What is the syntax forwrapping file output in an exception handler?

Note: You may want to review Ch. 8, “IO,” in OCP: Oracle® Certified Professional Java® SE 8 Programmer II Study Guide: Exam 1Z0-809 for help answering these questions.

 

The team member responsible for submitting the team’s work will submit the formatted FAQ document containing this week’s questions and answers to the Assignment Files tab.

 

 

PRG 421 Week 2 Individual: Week Two Analyze Assignment

Resource:

 

“Demonstrate the Coding to Produce Output to a File” text file

For this assignment, you will analyze Java™ that presents instructional text on the console, accepts user input, and then creates a file based on that user input.

 

Read the linked Java™ code carefully.

 

Then, answer the following questions in a Microsoft® Word file:

 

As you run the program in NetBeans the first time, at the prompt (the program will pause for input) type abc Return def Return ghi Ctrl+Shift+Del. What is the result?

As you run the program in NetBeans the second time, at the prompt (the program will pause for input) type 123 Ctrl+Shift +Del. What is the result?

What happens if the file Data.txt already exists when you run the program?

What happens if the file Data.txt does not already exist when you run the program?

Submit your Word file to the Assignment Files tab.

 

 

PRG 421 Week 2 Individual: Week Two Coding Assignment

Resource:

 

“Console/File Input and Output” text file

For this assignment, you will build on “starter” code to create a Java™ program that prompts the user for input, accepts user input, and produces both console and file output.

 

Copy the linked code to a JAVA file.

 

Add Java® code based on the comments inside the code.

 

Note: Refer to this week’s Individual “Week Two Analyze Assignment” for model code you can adapt to meet this assignment’s requirements.

 

Test, debug, and run your code using the NetBeans editor to make sure it meets the program requirements.

 

Save your JAVA file with a .txt extension.

 

Submit your TXT file to the Assignment Files tab.

 

 

PRG 421 Week 3 Learning Team: Stream Manipulation and Generics FAQ

The purpose of this assignment is to identify the syntax for a common data conversion or manipulation method and differentiate the syntax and intent of implementing a generic class versus an abstract class.

 

Continue working as a team on your FAQ document by answering the following questions and adding them to the Microsoft® Word document you started in Week One and continued in your Week Two Learning Team assignment, “Java I/O FAQ”:

 

The peek() method retrieves, but does not remove, the first element of a list. What is the syntax for peek()?

What is the difference between a generic class and an abstract class?

The team member responsible for submitting the team’s work will submit the formatted FAQ document containing this week’s questions and answers to the Assignment Files tab.

 

 

PRG 421 Week 3 Individual: Week Three Analyze Assignment

Resource:

 

“Java Code That Sorts, Extracts Data and Saves It To a Collection” text file

For this assignment, you will analyze code that uses a file input stream and a file output stream.

 

Read through the linked Java™ code.

 

In a Microsoft® Word document, answer the following questions:

 

Could this program be run as is? If not, what is it lacking?

Does this program modify the contents of an input stream? In what way?

What are the results of running this code?

Submit your completed Word document to the Assignment Files tab.

 

 

PRG 421 Week 3 Individual: Week Three Coding Assignment

For this assignment, you will develop “starter” code. After you finish, your code should access an existing text file that you have created, create an input stream, read the contents of the text flie, sort and store the contents of the text file into an ArrayList, then write the sorted contents via an ouput stream to a separate output text file.

 

Copy and paste the following Java™ code into a JAVA source file in NetBeans:

 

import java.io.BufferedReader;

 

import java.io.BufferedWriter;

 

 

 

public class Datasort {

 

public static void main (String [] args)  {

 

File fin =      // input  file

 

File fout =    // create an out file

 

// Java FileInputStream class obtains input bytes from a file

 

FileInputStream fis = new FileInputStream(fin);

 

// buffering characters so as to provide for the efficient reading of characters, arrays, and lines

 

BufferedReader in = new BufferedReader(new InputStreamReader(fis));

 

// declare an array in-line, ready for the sort

 

String aLine;

 

ArrayList<String> al = new ArrayList<String> ();

 

int i = 0;

 

while ((aLine = in.readLine()) != null) {

 

// set the sort  for values is greater than 0

 

Collections.sort(al);    // sorted content to the output  file

 

{

System.out.println(s);

}

 

// close the 2 files

 

}

 

}

 

Add code as indicated in the comments.

 

Note: Refer to this week’s Individual assignment, “Week Three Analyze Assignment,” and to Ch. 8, “IO,” in OCP: Oracle® Certified Professional Java® SE 8 Programmer II Study Guide.

 

Run and debug your modified program in NetBeans until it satisfies the requirements described above.

 

Save your finalized JAVA file with a .txt extension.

 

Submit your TXT file to the Assignment Files tab.

 

 

PRG 421 Week 4 Learning Team: Concurrency and Localization FAQ

The purpose of this assignment is to define key components of concurrency and to identify the purpose and benefit of localization, which is implemented (in part) using the Locale object.

 

Continue working as a team on your FAQ document by answering the following questions and adding them to the Microsoft® Word document you started in Week One and continued in your Week Three Learning Team assignment, “Stream Manipulation and Generics FAQ”:

 

What is a thread?

What is a process?

What is deadlock?

What is the purpose and benefit of localization?

The team member responsible for submitting the team’s work will submit the formatted FAQ document containing this week’s questions and answers to the Assignment Files tab.

 

 

PRG 421 Week 4 Individual: Week Four Analyze Assignment

Resource:

 

“Analyzing a Multithreaded Program”

Deadlock occurs when no processing can occur because two processes that are waiting for each other to finish. For example, imagine that two processes need access to a file or database table row in order to complete, but both processes are attempting to access that resource at the same time. Neither process can complete without the other releasing access to the required resource, so the result is deadlock.

 

Read and analyze code in the linked document that spawns two different threads at the same time.

 

In a Microsoft® Word file, predict the results of executing the program, and identify whether a deadlock or starvation event will occur and, if so, at what point in the code.

 

Submit your Word file to the Assignment Files tab.

 

 

PRG 421 Week 4 Individual: Week Four Coding Assignment

Resource:

 

“The Locale Object” text file

For this assignment, you will develop Java™ code that relies on localization to format currencies and dates.

 

In NetBeans, copy the linked code to a file named “Startercode.java”.

 

Read through the code carefully and replace all occurrences of “___?___” with Java™ code.

 

Note: Refer to “Working with Dates and Times” in Ch. 5, “Dates, Strings, and Localization,” in OCP: Oracle® Certified Professional Java® SE 8 Programmer II Study Guide for help.

 

Run and debug your JAVA file to ensure that your solution works.

 

Save your JAVA file with a .txt extension.

 

Submit your TXT file to the Assignment Files tab.

 

 

PRG 421 Week 5 Learning Team: JDBC-Related FAQ

The purpose of this assignment is to identify the JDBC API syntax necessary for establishing a connection to a database, retrieving data from a database, processing the data, and presenting a subset of the data on the console. Familiarity with the syntax for all of these methods will be required in this week’s Individual, “Week Five Coding Assignment.”

 

Continue working as a team on your FAQ document by answering the following questions and adding them to the Microsoft® Word document you started in Week One and continued in your Week Four Learning Team assignment, “Concurrency and Localization FAQ”:

 

What is the JDBC API syntax required in order to accomplish the following:

Establish a connection to a database

Create a statement (typically a query)

Execute the query

Process the query results

Close the database connection

The team member responsible for submitting the team’s work will submit the formatted FAQ document containing this week’s questions and answers to the Assignment Files tab.

 

 

PRG 421 Week 5 Individual: Week Five Analyze Assignment

Resource:

 

“Analyze and Document JDBC API Calls” text file

For this assignment, you will analyze code that uses the JDBC API to access a database, retrieve data, and compose output based on that data. You will then comment the code to reflect the purpose and expected results of the code.

 

Download the linked TXT file, and read through the Java™ code carefully.

 

Add your name, instructor’s name, and today’s date to the header comment.

 

Replace the five comment placeholders with succinct comments that explain and predict the results of the Java™ statement(s) that directly follow the comment placeholders.

 

Submit the updated TXT file containing your comments to the Assignment Files tab.

 

 

PRG 421 Week 5 Individual: Week Five Coding Assignment

Resource:

 

“Starter Code to Access Tables via JDBC” text file

For this assignment, you will create Java™ code that accesses a relational database, requests data, and then analyzes and displays a portion of that data.

 

Imagine a MySQL relational database schema named COMPANY_DB containing two tables, employee_table and payroll_table, such that the records in each of the tables is as follows:

  • employee_table:

Emp idFNameLNnameAddrCityStateZip
100JackSmith123 NorthTopeka KS66603
101JoeApple4 StreetDenverCO80202
111NancyGood45 SWHartfordCT06103
121TomWhatever89 NEDoverDE19901
122JimThompson789 W 95AlbanyNY12207
123TommyBoyson154 BoltBostonMA02201
125JohnJones47 WestLincolnNE68502

  • payroll_table:

Emp idPaysch401kSpouse
100BiWkyesyes
101BiWkyesyes
111Monthlynono
121Wklypendingyes
122Wklyyesno
123Monthlypendingno
125Monthlynoyes

The credentials you will need to access the database which holds both of the tables are as follows:

 

Host string = localhost:3306

Username = student

Password = prg421

Copy and paste the linked Java™ “starter” code into the NetBeans editor and save as a JAVA file.

 

Add Java™ statements to the file to accomplish the following:

 

Establish a connection to the database

Query the database, joining the two tables on the Emp_id field

Display your name and today’s date on the console along with the following returned database results:

employee identification number

first and last name

state

payroll schedule

401k plan

Close the database connection

Identify and correct any compile-time errors that exist in the starter code.

 

Note: Because you will not be connecting to an actual database, some compiler errors will remain.

 

After you finish, rename your JAVA file with a .txt extension using the following naming convention:

 

PRG421_Week5CodingAssignment_LastnameFirstname.txt.

Submit your TXT file to the Assignment Files tab.