Computer Science homework help

Computer Science homework help.  
 
 
 
COSC2436 – LAB5
Table of Contents
TITLE: 1
Time to complete. 1
COURSE OBJECTIVES – LEARNING OUTCOME. 1
LAB OBJECTIVES. 2
SKILLS REQUIRED TO DO THIS LAB. 2
HOW TO DO  EACH PART. 2
LAB 5 INSTRUCTION.. 3
DATA STRUCTURE CLASS. 3
DRIVER CLASS. 3
1.TYPE SINGLY LINKED LIST. 3
2.TYPE SINGLY LINKED LIST ITERATOR. 4
3.JAVA LinkedList WITH ITERATOR. 5
HOW TO TURN IN THE LAB. 5
 
 
 
Note: in the instruction of the lab change “yourLastName” to your last name
 

TITLE:

Singly Linked List – Iterator and java LinkedList
 
Time to complete:
Two weeks
 

COURSE OBJECTIVES – LEARNING OUTCOME

 
[LO1]
Provide UML class diagram and the code of data type classes
Provide the pseudo-code or flowchart based on the requirement of a project before writing the code of the driver class. Also, can access data members of data type classes
Describe and implement the inheritance relationship between super class and child classes.
Can use abstract classes or interface and apply polymorphism to the real-life problem project
 
[LO2]
Describe and implement operations of unsorted/sorted array-based structures
 
[LO11]
Determine BigO of each operation algorithm
Calculate Density of each data structure type
Evaluate and compare the performance of operations of each type of data structures
 
[LO4]
Describe and implement operations of Hashed data structures
 
 

LAB OBJECTIVES

-Create a new project, add source file to the project, compile and run the program without errors and qualified to the requirement
-Declare variables of int, double, String;
-provide UML of data types
-Create data types with data members, constructors, mutator methods
-Apply Inheritance relationship
-Apply polymorphism in the project
-provide the pseudo-code of program
-create and manage the menu to loop back to re-display after each task: using do.. while
-Use switch statement to determine and define the action for each task
-Format the output in columns and double numbers with 2 decimal digits
-Display message box
 
 
NEW CONCEPTS
-Can create the data structure type of Hash
-Can implement all the operations of SinglyLinkedList, SinglyLinkedListIterator and java LinkedList with Iterator
 

SKILLS REQUIRED TO DO THIS LAB

Review all skills required from the previous labs and focus on the following:
-Draw UML of data type classes
-Write pseudo-code or draw flowchart of algorithm
-Create a data type class with data members, constructors, mutator accessor methods, toString
-Declare an object in main(), how to access the methods of data type classes from main()
-control structure: if..else, switch, do..while loop
-How to set the decimal digits (2) of decimal numbers
 
-How to write the code to describe Inheritance relationship between child classes to parent class: How to inherit data members, constructors or methods from the parent class
-How to apply polymorphism technique to the project.
-How to create a Singly Linked List and how 4 operations work
-How to create a Singly Linked List with Iterator and how the iterator work with operations
-How to create java LinkedList with Iterator and how to access iterator with operations
 
 

HOW TO DO  EACH PART

From now and on yourLastName will be changed to your last name
 
*Step1: Read the requirement of each part.
Provide the UML of class Account_yourLastName, class CheckingAccount_yourLastname, class SavingAccount_yourLastName
Provide the pseudo-code or flowchart of main()
 
*Step2:
-start editor eclipse, create the project with the project name:
SP2020_LAB5_yourLastName
-add data type classes:
-add data structure classes
-Add the driver class
SP2020_LinkedListDemo_yourLastName
 
*Step3: follow UML and step by step in the pseudo-code to write the java code of all the classes
*Step4: compile and run the program
*Step5: debug if there are any errors to complete the program
 

LAB 5 INSTRUCTION

DATA TYPE CLASSES
-Reuse the class Account_yourLastName, CheckingAccount_yourLastName, SavingAccount_yourLastName from the previous lab
 

DATA STRUCTURE CLASS

SinglyLinkedList (page189)
SinglyLinkedListIterator (page 213)
 

DRIVER CLASS

Create an application that allows users to select different types of Linked List data structures to manage either Checking Account or Saving Account.
After finishing one, users can select to work with other types until they want to exit
 
SP2020_LinkedListDemo_Martinez.java
DATA STRUCTURE LIST – LUIS MARTINEZ

  1. Singly Linked List
  2. Singly Linked List with Iterator
  3. Java Linked List with Iterator
  4. Exit

 
For each selected type of data structure from the DATA STRUCTURE LIST do the following:
 
SP2020_LinkedListDemo_Martinez.java
TASKS LIST – LUIS MARTINEZ
1.Insert Account
2.Read Account
3.Verify Encapsulation
4.Update Account
5.Delete Account
6.Show all Account
0.Exit
 

1.TYPE SINGLY LINKED LIST

 
Create a Singly Linked List, Display the menu then allow users to do the selected task:
 
Insert Account
-display message to ask users to enter all the information that needs to create either a Checking account or Saving account
-Insert that account to the Data structure.
-Check if Insert returns true, display message “The account is open and insert successfully”
-If insert returns false, display message: “Cannot open this account”
 
Read Account
Allow users to enter the account number to look for the Checking Account or Saving Account.
– If the account cannot be found, display the message: “Account cannot be found”
– If the it is found, display the information of the Account is found and display the information of the account
 
VERIFY ENCAPSULATION
-Ask for users to enter an account number from the keyboard
-Read the account from the data structure
*If the account cannot be found in the data structure, display message “Account cannot be found. You must use an existing account to verify this feature”, then redisplay the list of tasks
*If the account is found, store it in the variable outsideAccount the do the following
 
-Deposit $100 to the outsideAccount
-read the account with the account number the same as the account number of outsideAccount from the data structure then store to fetchedAccount
 
-compare the balance amount of fetchedAccount and outsideAccount:
* if both balance amount are the same: display the message: “Singly Linked List is not encapsulated”
* If their addresses are different, display the message: “Singly Linked List is encapsulated”
 
UPDATE
-ask for the account number from the keyboard to update
-Read the account from the data structure
*If the account cannot be found in the data structure, display message “Account cannot be found. You must use an existing account to verify this feature”, then redisplay the list of tasks
*if the account is found, store it to the variable undateAccount then do the following:
-change the minimum amount of the updateAccount to $30
-Update the account in the data structure with account number as the same as account number
of the updateAccount
*if update is success, display message: “The minimum amount is changed”
*if update is not success, display message: “Update is failed. The minimum is not changed”
 
DELETE
– allow users to enter the account number of the account that they want to delete
-Delete the account with the input account number from the data structure
*if delete success, display the message: “Account is closed”
*if delete not success, display the message: “Account is not closed”
 
SHOW ALL
-show all accounts in the data structure
 

2.TYPE SINGLY LINKED LIST ITERATOR

Create the SinglyLinkedListIterator, display the menu then allow uses to do selected task:
 
Insert Account
-provide the message to ask users to insert at least 3 accounts, either checking account  or saving account
 
Read Account
-Read and display the first account in the data structure
*if the data structure is empty, display the message “The Linked List is empty, you should insert accounts first” then redisplay the list of tasks to allow users select Insert
*otherwise display the information of the first account
 
VERIFY ENCAPSULATION
-Read the second account in the data structure
*if the data structure is empty, display the message “The Linked List is empty, you should insert at least one account” then redisplay the list of tasks to allow users select Insert
*if the first account exists, do the following:
-store the first account to variable outsideAccount, deposit $200 to the outsideAccount
-read the first account again and store it in variable fetchedAccount
-compare the balance amount of fetchedAccount and outsideAccount:
* if both balance amount are the same: display the message: “Singly Linked List is not encapsulated”
* If their addresses are different, display the message: “Singly Linked List is encapsulated”
 
UPDATE
Update all the accounts in the data structure to have the new minimum amount is $100
 
DELETE
-Delete the third account from the data structure
*if delete success, display the message: “Account is closed”
*if delete not success, display the message: “Account is not closed”
 
SHOW ALL
-show all accounts in the data structure
 

3.JAVA LinkedList WITH ITERATOR

Create a java LinkedList then declare a ListInterator attached to it (page 224 for your reference), display the menu of tasks list then allow users to do selected task.
The instruction of all tasks is the same as of SinglyLinkedListIterator except update to add “2020” to in front of account numbers instead of changing the minimum amounts to $100
 

HOW TO TURN IN THE LAB

SP2020_LAB5_YourLastName.docx (UML, pseudocode or flowchart and output pictures)
Account_yourLastName.java
CheckingAccount_yourLastName.java
SavingAccount_yourLastName.java
SinglyLinkedList.java
SinglyLinkedListIterator.java
LinkedListDemo_yourLastName.java
 
Account_yourLastName.class
CheckingAccount_yourLastName.class
SavingAccount_yourLastName.class
SinglyLinkedList.class
SinglyLinkedListIterator.class
LinkedListDemo_yourLastName.class
 
.HOW TO GRADE THE LAB
 

HOW TO GRADE THE LAB Readings & Assignments
Turn in on time 3
All data type classes 1
class SinglyLinkedList 1
class SinglyLinkedListIterator 1
Display menu to choose the type  – Menu to choose the task
Handle to redisplay the menu
2
Declare the Singly Linked list object, perform insert, fetch, verify encapsulation, delete , update and showAll 6
Declare the SinglyLinkedListIterator, perform insert, fetch, verify encapsulation, delete , update and showAll 6
Declare the Java LinkedList object, Declare ListIterator object and attach it to LinkedList object,   perform insert, fetch, verify encapsulation, delete , update and showAll 6
Inheritance and polymorphism 1
compile success – qualified the requirements – comment 3
Total scores of Lab5 30

 

Computer Science homework help