Posts

Showing posts from July, 2017

[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 - inte

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 - int

[SOLVED] Buggy Search And Sort Buy Reporting with Java source code

Report The Bug From The Following Source Code: import java.util.Arrays; /** * This class looks like it's meant to provide a few public static methods for * searching and sorting arrays. It also has a main method that tests the * searching and sorting methods. *  * TODO: The search and sort methods in this class contain bugs that can cause * incorrect output or infinite loops. Use the Eclipse debugger to find the bugs * and fix them */ public class BuggySearchAndSort { public static void main(String[] args) { int[] A = new int[10]; // Create an array and fill it with random ints. for (int i = 0; i < 10; i++) { A[i] = 1 + (int) (10 * Math.random()); } int[] B = A.clone(); // Make copies of the array. int[] C = A.clone(); int[] D = A.clone(); System.out.print("The array is:"); printArray(A); if (contains(A, 5)) { System.out.println("This array DOES contain 5."); } else { System.out.println("This array DOES NOT contain 5."

[SOLVED] Implementation of hash tables from scratch in Java with full source code

The fact that Java has a HashMap class means that no Java programmer has to write an implementation of hash tables from scratch -- unless, of course, you are a computer science student. For this exercise, you should write a hash table in which both the keys and the values are of type String. (This is not an exercise in generic programming; do not try to write a generic class.) Write an implementation of hash tables from scratch. Define the following methods: get(key), put(key,value), remove(key), containsKey(key), and size(). Remember that every object, obj, has a method obj.hashCode() that can be used for computing a hash code for the object, so at least you don't have to define your own hash function. Do not use any of Java's built-in generic types; create your own linked lists using nodes as covered in section 9.2.2 of the textbook. However, you do not have to worry about increasing the size of the table when it becomes too full. Get your project now  Buy now

[SOLVED] Coke Machine Project in java with full source code

Purposes of this project: get you started using basic Java constructs, including: The use of Scanner to get user input Declarations, assignment statements, if and while statements. System.out.print and println methods. General idea: Simulate the operation of a Coke machine. This machine offers Coke, Coke Zero, and Caffeine-free Diet Coke. All drinks cost $1 (100 cents). The machine does not take dollar bills or pennies, but it does take nickels, dimes, and quarters. When enough money has been entered, a drink may be selected, and any change is returned (the specific coins are listed).Only coins in denominations of 5, 10, and 25 cents are accepted. Any other denomination (33 cents, 50 cents, etc.) is rejected and returned. More than one drink may be purchased (that is, the program doesn't quit after selling one drink).There is no way to turn off the coke machine. When you run the program from within Eclipse, you can stop it by pressing the red square. Example: Here is an ex

[SOLVED] Product listing and sorting program in Java with full source code

(Manipulating a Stream<Invoice ) Use the class Invoice to create a List of Invoice objects. Use the sample data shown in the Fig. Class Invoice includes four properties PartNumber (type int ), PartDescription (type String ), Quantity of the item being purchased (type int ) and Price (type double ). Perform the following queries on the List of Invoice objects and display the results: Use lambdas and streams to sort the Invoice objects by PartDescription , then display the results. Use lambdas and streams to sort the Invoice objects by Price , then display the results. Use lambdas and streams to map each Invoice to its PartDescription and Quantity , sort the results by Quantity , then display the results. Use lambdas and streams to map each Invoice to its PartDescription and the value of the Invoice (i.e., Quantity * Price ). Order the results by Invoice value. Modify Part (d) to select the Invoice values in the range $200 to $500. Get your solution now  Buy now

[SOLVED] Airplane seat reservation system in java with full source code

In this project, you will implement an airplane seat reservation system. An airplane has two classes of service (first and economy). Each class has a sequence of seat rows. The following figure shows the seat chart of the airplane. A reservation request has one of two forms. One form is that an individual passenger request consists of the passenger name, a class of service, and a seat preference such as W(indow), C(enter), or A(aisle) seats. The reservation program either finds a matching seat (the search may start from the first row of the class.) and reserves it for the passenger, or it fails if no matching seat is available. (For example, if the user's preference is a W(indow) seat and none is available, tell the user no Window seat is available and ask for another seat preference.) The other form is that a group request consists of a list of passenger names and a class of service. (Groups cannot specify a seat preference). The reservation program finds the first row of adjace

[SOLVED] Java Programming Questions with full source code

Question 1 Write a Java program to compose a random sequence of 10 case-sensitive letters. Allowable letters are: C,D,E,F,G,A,B,c,d,e,f,g,a,b. Assign random values to each letter. Allowable values are 4,3.5,3,2.5,2,1.5,1,0.5. Display a comma separated list of each generated letter followed by its assigned value. Do not include a space between the letter and its assigned value. Use an array as part of the solution to this question. Question 2 Write a program that prompts the user for a character in the range of a-z (inclusive) and 3 integers in the range of 1-9 (inclusive). The program should convert the character into lowercase and get its numeric equivalent (where a is 1, b is 2 … z is 26) and multiply the numeric equivalent by the sum of the integer inputs. The program should print the inputs and the total in CSV format to a file. The first line in the file should contain headings. The second line should contain the values. Each output should be separated by the | symbol. The

[SOLVED] Solver for Sudoku puzzles in Java with full source code

Introduction The purpose of the project is to try in practice the use of recursion and object-oriented program design. Please make sure to read this entire note before starting your work. Pay close attention to the sections on deadlines, deliverables, and exam rules. The problem Your task in this part of the project is to write a solver for Sudoku puzzles. Sudoku puzzles are a kind of crossword puzzles with numbers where the following two conditions have to be met: In each row or column, the nine numbers have to be from the set [1,2,3,4,5,6,7,8,9] and they must all be different. For each of the nine non-overlapping 3x3 blocks, the nine numbers have to be from the set [1,2,3,4,5,6,7,8,9] and they must all be different. The following two figures show a Sudoku puzzle and its solution. The input The input of your program, the Sudoku puzzles, is given in text files. More specifically, they are represented as nine lines of nine characters separated by spaces. The characters can b

[SOLVED] Tape for a Turing Machine using Doubly-linked List in Java with full source code

Tape for a Turing Machine (Doubly-linked List) Short exercise in which you will code part of an existing project. In this case, you will be working with a doubly-linked list. To make this topic more interesting, the list that you work on will be part of a Turing Machine. A Turing Machine is a kind of very simple, abstract computing device that was introduced in the 1930's by Alan Turing as a way of studying computation and its limitations. The classes that you need for the lab are in a package named turing. You will define a new class named Tape in this package. You can find the Java source in the code directory. You should copy this directory into an Eclipse project. There will be errors, since the existing classes depend on the Tape class, which you have not yet written. Don't forget the Javadoc comments. A Class for Turing Machine Tapes A Turing machine works on a "tape" that is used for both input and output. The tape is made up of little squares called cell

[SOLVED] Java GUI project with toolbar and panels | Editing project with full source code

For this lab, you will do some work on a GUI program. Most of the work is related to actions, buttons, menus, and toolbars.When you turn in your work for this lab, you should also turn in an executable jar file of your program, in addition to all the files from your Eclipse project. See the last section on this page for information about how to create executable jar files. To begin the lab, create a new project in Eclipse and copy-and-paste both directories – guidemo and resources -- from the code directory into your Eclipse project. The guidemo directory is a package that contains the Java code of the program. The resources directory has several sub-directories that contain image and sound resources used by the program. You will be working only on the code in the guidemo package. The code directory also contains an executable jar file of the completed program, GuiDemoComplete.jar. You can run this jar file to see how the program should look when it's done. In the incomplete so

[SOLVED] Travelling Salesman problem with full source code in Python | TSP project

Firstly, this worksheet is one of the worksheets from which your laboratory worksheets portfolio of work will be assessed. This worksheet is about empirically evaluating how scalable a number of single population heuristic search methods are at solving the Travelling Salesman Problem (TSP) when applied to a number of different sized problems. The aim is to evaluate and demonstrate how well each of the methods performs as the size of the problem increases. The overall objective of this worksheet is to produce; present and report on, a Java program that is capable of solutions the TSP on a number of different sized problems using a number of different heuristic search algorithms (see below). Solving the TSP Problem The Travelling Salesman problem (TSP) has been described fully in the lectures. The purpose of this worksheet is to: 1) Implement a number of the algorithms (listed below) to solve the TSP 2) Compare the algorithms on a number of different sized datasets 3) Report o

[SOLVED] London’s Premier Burrito Food Trucks Case study full database solution

The purpose of this coursework is to create a database ER schema and relational schema based on specific domain based on the provided requirements. This coursework also involves implementing your relational schema in SQL and writing some queries in SQL’s Data Manipulation Language. This coursework is comprised of 2 Parts, each with separate deadlines. Be aware any late submissions will have the grade for that part capped at 40%. This is Part 1 of the Coursework. The entire coursework is formally assessed and is worth 10% of your final grade. Each Part of the Coursework is worth 5%. You will receive some feedback as part of the marking of the coursework. Part 1: Design (1.1) Identification and representation of entities, relationships and attributes. (1.2) Identification and representation of relationship cardinalities based on the coursework requirements, or by making proper use assumptions if the coursework requirements are vague. Any assumptions need to be reasonable and re

[SOLVED] Implementing 8-puzzle search in java with full source code | download now

The 8-puzzle problem In this project you will implement a solution to the 8-puzzle by state-space search, using the search engine described in the lectures, and experiment with search strategies. 2. What you must do 2.1 Implementing 8-puzzle search In the search2 folder in the Java download on the COM1005/2007 MOLE site is the code for the simple search engine and for Jugs problems. Note that you may have to recompile the code for your version of Java. Following the instructions in section 2.9 of the lecture notes, write classes to implement a state-space search for 8-puzzle problems. You should not need to change the code for the search engine except perhaps to control how much it prints as a search proceeds, and to stop the search after a given number of iterations (in an 8-puzzle the search tree can become large). Test your implementation with breadth-first searches for the following initial con- figurations and the same goal state as above: 2.2 Experimenting with

[SOLVED] Online shopping site with the member system and real store stock checking system

System Background The online shopping site with the member system and real store stock checking system When user buy online will earn the points  User will go to the shop to take the product so no need to store address in “Order”  Database Requirement Catalog  Type  Product Shops (With Address and Location Order Stock User Login (Email / ID card + Password) …And more Get your project now  Buy now

[SOLVED] INST2005 Database Systems | Assessed Design Exercise 2017

Some friends of yours are hoping to set up a data driven website to support their home business selling second-hand children clothes, and have asked for your advice on the database design side. They need a database to list all the available items for customers to purchase, and also want to have a user comments system so that visitors can give feedback on purchased items as well as buy them. They are not database experts, and they have asked you to devise a database model they could use. Their ISP has said they can mount and operate a database on their account if given a set of relational tables, which describe it, so this is ultimately what they want you to produce. As a minimum, they would like to store the following information about each item of clothing: the kind of garment, colour, size, material, gender (where appropriate), condition, age, and how much it costs, plus feedback once sold, if available. For customers they would want to record name, postal address, email address an

[SOLVED] JavaFX | Body Mass Index Calculator App in JavaFX with full source code

(Body Mass Index Calculator App) The formulas for calculating the BMI are BMI = (weightInPounds × 703)/(heightInInches × heightInInches) or BMI = (weight In Kilograms)/(height In Meters × height In Meters) Create a BMI calculator app that allows users to enter their weight and height and whether they are entering these values in English or metric units, then calculates and displays the user’s body mass index. The app should also display the following information from the Department of Health and Human Services/National Institutes of Health so that users can evaluate their BMIs: BMI VALUES Underweight: less than 18.5 Normal: between 18.5 and 24.9 Overweight: between 25 and 29.9 Obese: 30 or greater Get your solution now  Buy now

[SOLVED] Algorithm to find that a given binary tree is also balanced tree (AVL Type)

AVL Tree Balance Tree Checker Algorithm: Design an algorithm which tests if an input binary tree is also balanced tree (AVL type). Prove algorithm's correctness and estimate its complexity. We're using appropriate format for the report according to the requirements Get your solution now  Buy now

[SOLVED] Cash Register program using Greedy Algorithm in Java with full source code

Program Formal Description: The driver class should initially fill the register with 0x$100, 0x$50, 10x$20, 20x$10, 20x$5, 0x$2, 50x$1, 80x$0.25, 50x$0.10, 20x$0.05, 100x$0.01 The program should ask the user the following: Make a sale make change print balances exit For a sale: the program class should prompt for the cost and how much of each type of currency were given If the register can not make the correct change, print an appropriate message For making change: the program should ask which currency is being provided and how much of that currency, then it should output what currency is being given example, make change, provide 4 quarters, register gives 1x$1 example, make change, provide 50 dimes, register gives 1x$5 OR 5x$1 OR 4x$1, 4x$0.25 For print balances, just show what is currently in the register of every currency Calculate Big-Oh for all 3 processes Calculate actual operations for making a sale and print out (don't forget to include the cost of usin

[SOLVED] Online shopping site with the member system and real store stock checking system | ERD & Database

System Background The online shopping site with the member system and real store stock checking system When user buy online will earn the points User will go to the shop to take the product so no need to store address in “Order” Database Requirement Catalog  Type  Product Shops (With Address and Location Order Stock User Login (Email / ID card + Password) And more What you'll get in solution: Complete ERD of the database system in Crown's Foot Notation Format Full Functional, ready to import MySQL database Sample Screenshot of ERD Get your project now  Buy now

[SOLVED] Geek Even and Old Answers to the Questions

Introduction: Write a class definition (not a program, there is no main method) named Geek (saved in a file Geek.java) that models a person who is a geek. For our purposes, a geek is someone who delights in answering all sorts of questions, such as “if a number is even or odd?”, “what is the factorial of a number?”, among other things. A Geek has a name and also keeps track of how many questions s/he has answered. Your Geek class must have only two instance variables – the Geek’s name and number of questions asked so far Methods: public Geek (String name): the Geek's name, the number of questions is assigned to zero public String getName(): takes no parameters and returns the Geeks’s name as a String (don’t count this request in the total questions) public int getNumberOfQuestions(): takes no parameters and returns as an int how many questions has been asked (don’t count this request in the total) public boolean isEven (int num): takes an integer and returns a boolean va

[SOLVED] Web server sending files to a web browser on request with full source code

Web Server The goal of this lab is to write a simple, but functional, web server that is capable of sending files to a web browser on request. The web server must create a listening socket and accept connections. It must implement just enough of the HTTP/1.1 protocol to enable it to read requests for files and to send the requested files. It should also be able to send error responses to the client when appropriate. Seeing HTTP in Action It would be useful to see the HTTP protocol in action before beginning your work. Your program will have to read HTTP requests and send HTTP responses To see what an HTTP request might look like, you can run the program ReadRequest, which can be found in the code directory. To run the program, cd to that directory on the command line, and enter the command java ReadRequest. The program is ready to accept requests from web browsers on port 50505. (It will continue to do so until you terminate the program.) When it receives a request, it simply pr