Posts

Showing posts with the label Object Oriented Programming

[SOLVED] Trivia Game using Linked List, Polymorphism and Inheritance in Java

You will need to first create an object class encapsulating a Trivia Game which INHERITS from Game. The game is the parent class with the following attributes: description - which is a string write the constructor, accessor, mutator and toString methods.  Trivia is the subclass of Game with the additional attributes: trivia game id - integer ultimate prize money - double number of questions that must be answered to win-integer. write the accessor, mutator, constructor, and toString methods. Write a client class to test creating Trivia objects. Once you have successfully created Trivia objects, you will continue by creating a linked list of trivia objects. Your linked list code should include the following: a TriviaNode class with the attributes: trivia game - Trivia object next- TriviaNode write the constructor, accessor, mutator and toString methods. A TriviaLinkedList Class which should include the following attributes: head - TriviaNode number of items - ...

[SOLVED] Linked List project in Java | Addition at specific index | Reverse List | Remove Sorted and UnSorted

Java Code Extension Add the following methods to the list class on the file: public void addAt(int position, T item) The method adds an item at a given position.  The head has position 1, second item has position 2, etc. public void removeAllSorted(T item) The method removes all copies of the given item, assuming the list is sorted.   For example, if you have a list (1, 2, 2, 2, 3, 4) And you remove 2 So, the output for this method will be (1, 3, 4) public void removeAllUnsorted(T item) The method removes all copies of the given item, assuming the list is not sorted.   For example, if you have a list (2, 3, 4, 2, 1, 2) And you remove 2 So, the output for this method will be (3, 4, 1) public void reverseList() The method reverses the list.  For a sorted list, reversal would result in a list reversely sorted. For example, if you have a sorted list (1, 2, 3, 4, 5, 6) So, the output for this method will be (6, 5, 4, 3, 2, 1) For implementat...

[SOLVED] Using Arrays, Strings, & Sorting Personnel.java TestPersonnel.java classes in Java Programming

Introduction Define a Java class as described below. All variables should be declared as private and all methods as public. Save the class definition in a file with an appropriate filename. Class Name: Personnel Instance Variables:  Name – String (in the format lastName, firstName – Example: Carter, Lisa) jobTitle - String payRate – double Instance Methods:  A default constructor. A constructor that accepts three arguments, one for each of the fields. getter methods for each of the class fields. toString() A method to display the fields of an instance of the class in an easy to read format (preferable on one line). Compile and debug the above code. Class Name: TestPersonnel Then, create a class, TestPersonnel, that contains a main() with static methods to test and use the above class. Save the class in a file with an appropriate file name. Declare three initialized arrays, one for the Job Code, and two associated arrays for Job Title and the Pay Rates as fol...

[SOLVED] Binary Sort Tree with all the features like depth of tree with 1023 nodes

In Subsection 9.4.2, the textbook (http://math.hws.edu/javanotes/) says that "if the [binary sort] tree is created by inserting items in a random order, there is a high probability that the tree is approximately balanced." For this exercise, you will do an experiment to test whether that is true. In the Introduction to this Learning Guide, you read that the depth of a node in a binary tree is the length of the path from the root of the tree to that node. That is, the root has depth 0, its children have depth 1, its grandchildren have depth 2, and so on. In a balanced tree, all the leaves in the tree are about the same depth. For example, in a perfectly balanced tree with 1023 nodes, all the leaves are at depth 9. In an approximately balanced tree with 1023 nodes, the average depth of all the leaves should be not too much bigger than 9. On the other hand, even if the tree is approximately balanced, there might be a few leaves that have much larger depth than the average, s...

[SOLVED] The Pizza Preferences Survey - Application

In this project, you are asked to modify your program from Assignment 1 (The Pizza Preferences Survey). Make this program store the collected data in a database, instead of the text file. Implement the delete data entry feature, as in StudentJDBC example. It is not required to implement the editing. Implement one or more logins for administrators using DataSourceRealm, with salted and hashed passwords. You may implement several levels of access (roles), like in HelloLogins, but it is not required. Viewing and removing data should require logging in. The administrator password should not be “sesame”, encrypt another password. Copy-paste your steps of the encryption (as in the posted “sesame.txt” file) in your own “readme.txt” file and submit it with the code. You are also required to submit your “pizza.sql” file that you used to generate the database for your program. Some thoughtful reworked copy-pastes from examples posted on SLATE are allowed, but mindless copy-pastes are ex...

[SOLVED] The Towers of Hanoi Puzzle in Java | Resit Programming Project

The Towers of Hanoi Puzzle The description of this problem is taken from the book by Douglas Baldwin and Greg W Scragg (2004), Algorithms and Data Structures: The Science of Computing. Hingham MA: Charles River Media. Legend tells of an ageless temple in the city of Hanoi. Within this temple are three poles of diamond piercing 64 golden disks of varying sizes. At the moment of creation, the disks were stacked smaller-on-top-of-larger on the leftmost pole. Since then, the monks of the temple have been moving the disks from the left pole to the right pole, subject to the following rules: The monks only move one disk at a time. Every disk taken off a pole has to be put back on some pole before moving another disk. The monks never put a disk on top of a smaller one. When all the disks have been moved to the right-hand pole, the purpose of creation will have been fulfilled and the universe will end. It’s not immediately obvious how (or even if) the monks can move the disks to the ri...

[SOLVED] Interactive Fiction Game in Java | Adventure Game | Java Assignments Help | Algorithm

Introduction: Once upon a time, before the dawn of the Internet, as we know it, there lived a forgotten type of computer game called interactive fiction. First written in the late '70s, these games were sort of a choose-your-own-adventure book, but for geeks. These games contain no graphics, just a 2nd person (everybody remembers English class right?) description of your character, and a box for entering commands. With the birth of the Kindle and other Internet-enabled e-readers, these games are experiencing something of a rebirth, as their screens are a perfect match for these games. To play one for yourself, go to http://www.portablequest.com Your project is to create an interactive fiction. In this game, you will navigate a map (moving east, west, north, south when possible). In each “room” of the map, the game will print a description of the room to the screen. As you navigate through the map, you will be looking for a light to light up the dark rooms, a key to open a tre...

[SOLVED] Connect-K in Java Data Structures Compelete Source code

In the game of Connect-K, red and blue pieces are dropped into an N-by-N table. The the table stands up vertically so that pieces drop down to the bottom-most empty slots in their column. For example, consider the following two configurations: In these pictures, each '.' represents an empty slot, each 'R' represents a slot filled with a red piece, and each 'B' represents a slot filled with a blue piece. The left configuration is legal, but the right one is not. This is because one of the pieces in the third column (marked with the arrow) has not fallen down to the empty slot below it. A player wins if they can place at least K pieces of their colour in a row, either horizontally, vertically, or diagonally. The four possible orientations are shown below: - Four in a row - R RRRR R RR R RR R RR R R In the "Legal Position" diagram at the beginning of the problem statement, both players had lined up two pieces in a row, but not three. You have a t...

[SOLVED] Car Racing Java API Level 2.2 complete implementation with source code.

In this coursework, you are required to implement an Android Game App, create an installable apk that can be installed on an Android phone (API level 2.2) and write a report that describes the design and justifies improvements. The GameYou are required to develop Java code to implement an Android app inspired by the traditional top-down racing game. The code MUST extend the code base provided for the practical in week 7 of Spring term. The OOP DesignYou are required to develop an OOP design before starting implementation. This should be discussed and signed off in your practical session in week 8 of spring term. This will be marked in that week’s practical sign off sheet. You must include an electronic version (e.g. scan handwritten work) in an appendix of the submitted report. You can later change the design. You must, however, justify your changes in the final report Your game should: Have functionality to start individual games on a screen using a separate welcome or sta...

Geometer y and pricing inheritance program in C++ complete source code

A class is a programmer-defined data type that describes what an object of the class will look like when it is created. It consists of a set of variables and a set of functions. A class is repository of functions that any main program may use. In this project you will create two classes and two main drivers to test the classes. Part I Part I will produce 2 files. Geometry.h file is the Geometry class with its members and functions. main cpp file tests all the code in the Geometry class. The textbook examples place the class code in the same file as the main function, but your code will be more re-usable if the class is defined in a separate file – Geometry.h . The header file will need to be included in the program as you did in the Airline Problem and the array.h file. The final version of the Geometry class (Geometry.h) will include: Three constructors:  Constructor 1 – receives 2 integer values for length and width. (rectangle) Calls checkNum to validate each value. ...

CSE205 Object Oriented Programming and Data Structures

3.1 In the video lecture for Sorting Algorithms: Section 7: Merge Sort Example we traced how merge sort would recursively sort list = { 4, 2, 7, 3, 5, 13, 11, 8, 6, 2 }. For this exercise, I would like you to draw a similar diagram showing how merge sort would sort list = { 5, 3, 1, 6, 2, 4 }. Scan this diagram and insert it into your final PDF. The objective of this exercise is to essentially see if you understand how the merge sort procedure works. 3.2 In Sorting Algorithms: Section 9: Merge Sort Pseudocode we discussed the high-level pseudocode for the merge sort algorithm. I wrote three methods: recursiveMergeSort(), merge(), and copyRest(). Continuing the previous exercise, how many times will recursiveMergeSort() be called when sorting the list of Exercise 3.1. Include the original nonrecursive call to recursiveMergeSort() and all of the recursive calls in the sum. 3.3 Continuing, how many times will merge() be called? 3.4 Continuing, during the final call to merge()—when we ...

[SOLVED] Algorithms and Data Types - RESIT CASE STUDY Eldora-do Holidays Booking System

Eldora-do Holidays Eldora-do Holidays provides happy holidays for young tourists who are after a good time. They require an information system for their growing trade. Brochures are sent out to past clients and those who have booked in the current season. Their preference for type of holiday as well as the usual name and address type of information has to be held. Brochures are sent out to clients at Christmas, Easter and in the autumn if clients have expressed an interest in winter holidays. Clients who have been sent one brochure in any year are not sent another, except for those interested in winter holidays. The system will hold holiday booking details. When making a booking clients are required to provide a backup choice of resort. Long-standing clients are given priority when there is a booking clash. Eldora-do has three types of holiday: Sun-burners, Activity, and Winter. None of the resorts offers all three types, but a few offer two. All holidays take place at a particu...

[SOLVED] Branch Coverage, Statement Coverage and Path Coverage | Java Unit Testing

Create a directory called “TestClassValue” Hereafter, we call this directory <dir>. Create a Java class com.work.sample.FlawedClass in directory <dir>/src. (The actual path will obviously reflect the package structure.) 100% Branch Coverage & 100% Statement Coverage Add to the class a method called flawedMethodl that contains a division by zero fault such that it is possible to create a test suite that achieves 100% branch coverage and does not reveal the fault every test suite that achieves 100% statement coverage reveals the fault. Conversely, if you were able to create the method, then create two JUnit test classes com.work.sample.FlawedClassTestBCl and com.work.sample.FlawedClassTestSCl for class FlawedClass as follows: FlawedClassTestBCl should achieve 100% branch coverage of flawedMethodl and not reveal the fault therein. FlawedClassTestSCl should achieve 100% statement coverage of flawedMethodl and reveal the fault therein. Both classes should be...

CSIT 211 – Final Project and Presentation Guidelines | Object Oriented Programming

In groups of 2 to 4 students, you will implement one large program or 2 to 3 smaller programs of your choice, using all of the topics below. This is a collaborative project, so make sure you are working as a team. It may take some time to develop a program topic or topics, that satisfy the final project requirements. All groups and topics of the project elements need to be approved by the instructor. Your project should also have a real world component if possible. For example, you could create a scheduling program that makes use of a doubly linked list; a mock package delivery tracking system that uses priority queues; a program that can determine if a graph is two colorable for any given graph, etc. You can use some of the programming practice samples from the end of the chapters to get an idea. All groups will present their projects on the last day of class. You will need to submit through blackboard the following: All associated project code with contacting all group members’...

[SOLVED] Store and Restaurant OOP Scenario | Inheritence

Project Description Write a class encapsulating a Restaurant, which inherits from Store. The store has the following attributes: name sales tax rate A Restaurant has the following additional attributes: how many people are served every year the average price per person?  Code the constructor, accessors, mutators, toString and equals method of the super class Store and the subclass Restaurant; also in Restaurant - code a method returning the average taxes per year. Also, needs to include a client class to test your code for both the parent class and the subclass. Should test creating Store objects and Restaurant objects, your set methods and get methods, toString and equals methods. Buy now CONTACT DETAILS For any other questions or other tasks please feel free to contact me via email: mhassnainjamil@gmail.com via WhatsApp: +92-324-7042178 via skype: hassnainjamil1

[SOLVED] Store and Restaurant OOP Scenario | Inheritence

Project Description Write a class encapsulating a Restaurant, which inherits from Store. The store has the following attributes: name sales tax rate A Restaurant has the following additional attributes: how many people are served every year the average price per person?  Code the constructor, accessors, mutators, toString and equals method of the super class Store and the subclass Restaurant; also in Restaurant - code a method returning the average taxes per year. Also, needs to include a client class to test your code for both the parent class and the subclass. Should test creating Store objects and Restaurant objects, your set methods and get methods, toString and equals methods. Buy now