The following are screen grabs of the provided files
Thanks so much for your help, and have a nice day!
Hi, The entire assignment is too big to be completed in the given time, I am sharing the Toy .java and Tamogotchi.java classes both of which are fully implemented. Please share another question so that the second part can be addressed.
thank you for understanding.
=================================================================================
import java.util.ArrayList; import java.util.Random; public class Toy { private String name; private String color; private String type; private int experienceGained; private static String[] names = {"Bob", "Penny", "Fisher", "Snoopy", "Garfield", "Mary", "Chuchu", "Trooper", "Lovebug", "Bella"}; private static String[] colors = {"red", "blue", "green", "yellow", "orange", "purple"}; private static String[] types = {"car", "doll", "stuffed cat", "train", "ball", "kite", "teddy bear", "trike"}; private static Random r = new Random(); public Toy(String name, String color, String type, int experienceGained) { this.name = name; this.color = color; this.type = type; this.experienceGained = experienceGained; } public Toy() { this.name = getRandomName(); this.color = getRandomColor(); this.type = getRandomType(); this.experienceGained = 10 + r.nextInt(15); } private static String getRandomName() { int i = r.nextInt(names.length); return names[i]; } private static String getRandomColor() { int i = r.nextInt(colors.length); return colors[i]; } private static String getRandomType() { int i = r.nextInt(types.length); return types[i]; } public String getName() { return name; } public String getColor() { return color; } public String getType() { return type; } public int getXp() { return experienceGained; } @Override public String toString() { return getName() + " the " + getColor() + " " + getType(); } public Toy createToy(String details) { String[] data = details.split("\\t"); if (data.length != 4) { throw new IllegalArgumentException("Insufficient Data provided"); } Toy aToy = new Toy(data[0], data[1], data[2], Integer.parseInt(data[3])); return aToy; } public Toy findBestToy(ArrayList<Toy> toys) { Toy theBestToy = null; int experience = 0; for (Toy aToy : toys) { if (experience < aToy.getXp()) { experience = aToy.getXp(); theBestToy = aToy; } } return theBestToy; } }
=========================================================================
import java.util.ArrayList; public class Tamagotchi { private String name; private int level; private double energy; private int experiencePoint; private int mealsEaten; ArrayList<Toy> toys; public static final double MAX_ENERGY = 10.0; public Tamagotchi(String name, int level, double energy, int experiencePoint, int mealsEaten, ArrayList<Toy> toys) { this.name = name; this.level = level; this.energy = energy; this.experiencePoint = experiencePoint; this.mealsEaten = mealsEaten; this.toys = toys; } public Tamagotchi(String name) { this.name = name; level = 0; energy = MAX_ENERGY; mealsEaten = 0; Toy aToy = new Toy(); toys = new ArrayList<>(); toys.add(aToy); } public String getName() { return name; } public int getLevel() { return level; } public double getEnergy() { return energy; } public int getExperiencePoint() { return experiencePoint; } public int getMealsEaten() { return mealsEaten; } public ArrayList<Toy> getToys() { return toys; } }
=======================================================================================
The following are screen grabs of the provided files Thanks so much for your help, and have a n...
This assignment attempts to model the social phenomenon twitter. It involves two main classes: Tweet and TweetManager. You will load a set of tweets from a local file into a List collection. You will perform some simple queries on this collection. The Tweet and the TweetManager classes must be in separate files and must not be in the Program.cs file. The Tweet Class The Tweet class consist of nine members that include two static ones (the members decorated with the...
Purpose of it is to coordinate the interaction between the user and the lower-level functionality of the game. There are two overloaded constructors, one for constructing a brand new game and one for constructing a game from a file. w - Move Up s - Move Down a - Move Left d - Move Right q - Quit and Save Board If the user inputs any one of these characters, execute the corresponding move. This should result in a refreshed...
Your assignment is to write a grade book for a teacher. The teacher has a text file, which includes student's names, and students test grades. There are four test scores for each student. Here is an example of such a file: Count: 5 Sally 78.0 84.0 79.0 86.0 Rachel 68.0 76.0 87.0 76.0 Melba 87.0 78.0 98.0 88.0 Grace 76.0 67.0 89.0 0.0 Lisa 68.0 76.0 65.0 87.0 The first line of the file will indicate the number of students...
4.3Learning Objective: To read and write text files. Instructions: This is complete program with one Java source code file named H01_43.java (your main class is named H01_43). Problem: Write a program that prompts the user for the name of a Java source code file (you may assume the file contains Java source code and has a .java filename extension; we will not test your program on non-Java source code files). The program shall read the source code file and output...
Java Software Originals, Inc., has been hired by Eaton Wright, the "pizza king", to help automate a new chain of pizza delivery stores. SOI's system engineering staff have asked you to implement a prototype for the telephone operator's console. To start the project they have assigned you to implement the following two static methods (the first of which will be used to read files containing menus of pizza sizes and their prices, and pizza toppings and their prices; and the...
In java netbean8.1 or 8.2 please. The class name is Stock. It has 5 private attributes (name, symbol, numberOfShares, currentPrice and boughtPrice)and one static private attribute (numberOfStocks). All attributes must be initialized (name and symbol to “No name/ symbol yet” and numberOfShares, currentPrice and boughtPrice to 0. Create two constructors, one with no arguments and the other with all the attributes. (However, remember to increase the numberOfStocks in both constructors. Write the necessary mutators and accessors (getters and setters) for...
create a new Java application called "CheckString" (without the quotation marks) according to the following guidelines. ** Each method below, including main, should handle (catch) any Exceptions that are thrown. ** ** If an Exception is thrown and caught, print the Exception's message to the command line. ** Write a complete Java method called checkWord that takes a String parameter called word, returns nothing, and is declared to throw an Exception of type Exception. In the method, check if the...
C++ programming question, please help! Thank you so much in advance!!! In this exercise, you will work with 2 classes to be used in a RPG videogame. The first class is the class Character. The Character class has two string type properties: name and race. The Character class also has the following methods: a constructor Character(string Name, string Race), that will set the values for the name and the race variables set/get functions for the two attributes a function print(),...
PLEASE DO IN JAVA 3) Add the following method to College: 1. sort(): moves all students to the first positions of the array, and all faculties after that. As an example, let fn indicate faculty n and sn indicate student n. If the array contains s1|f1|f2|s2|s3|f3|s4, after invoking sort the array will contain s1|s2|s3|s4|f1|f2|f3 (this does not have to be done “in place”). Students and faculty are sorted by last name. You can use any number of auxiliary (private) methods, if needed....
Problem 5: Monster Factory (10 points) (Game Dev) Create a Monster class that maintains a count of all monsters instantiated and includes a static method that generates a new random monster object. In software engineering, a method that generates new instances of classes based on configuration information is called the Factory pattern. UML Class Diagram: Monster - name: String - health: int - strength: int - xp: int + spawn(type:String): Monster + constructor (name: String, health: int, strength: int, xp:...