Welcome to AssignmentCache!

Search results for 'Access College Pet Sitters'

Items 1 to 10 of 15 total

per page
Page:
  1. 1
  2. 2

Grid  List 

Set Ascending Direction
  1. PRG421 Week 3 Lab 3.17 LAB Pet information (derived classes)

    PRG/421 Week 3 Java 3.17 LAB: Pet information (derived classes)

    Regular Price: $6.00

    Special Price $3.00

    PRG/421 Week 3 Lab 3.17 LAB: Pet information (derived classes)

    The base class Pet has private fields petName, and petAge. The derived class Dog extends the Pet class and includes a private field for dogBreed. Complete main() to:
    - create a generic pet and print information using printInfo().
    - create a Dog pet, use printInfo() to print information, and add a statement to print the dog's breed using the getBreed() method.

    Ex. If the input is:
    Dobby
    2
    Kreacher
    3
    German Schnauzer

    The output is:
    Pet Information:
    Name: Dobby
    Age: 2
    Pet Information:
    Name: Kreacher
    Age: 3
    Breed: German Schnauzer

    Learn More
  2. PRG421 Week 4 Java 4.6 LAB Zip code and population (generic types)

    PRG/421 Week 4 Java 4.6 LAB: Zip code and population (generic types)

    Regular Price: $7.00

    Special Price $3.00

    PRG/421 Week 4 Java 4.6 LAB: Zip code and population (generic types)

    Define a class StatePair with two generic types (Type1 and type2), a constructor mutators, accessors, and a printinfo() method. Three ArrayLists have been pre-filled with StatePair data in main():
    • ArrayList<StatePairInteger, String>> zipCodeState: Contains ZIP code/state abbreviation pairs
    • ArrayList<StatePair<string, String>> abbrevstate: Contains state abbreviation/state name pairs
    • ArrayList<StatePair<string. Integer>> state Population Contains state name/population pairs

    Complete main() to use an input ZIP code to retrieve the correct state abbreviation from the ArrayList ZipCodeState. Then use the state abbreviation to retrieve the state name from the ArrayList abbrevState. Lastly, use the state name to retrieve the correct state name/population pair from the ArrayList state Population and output the pair.

    Ex If the input is:
    21044

    the output is:
    Maryland: 6079602

    Learn More
  3. CIS355A Week 6 Lab - Database Connectivity Student Management System Add student

    CIS355A Week 6 Lab - Database Connectivity Student Management System

    Regular Price: $10.00

    Special Price $8.00

    CIS355A Week 6 Lab - Database Connectivity Student Management System

    OBJECTIVES
    • Programmatic access to a MySQL database to add and display records


    PROBLEM: Student Management System
    A teacher needs the ability to store and retrieve student data. This includes
    • student name;
    • three test scores;
    • average; and
    • letter grade.

    FUNCTIONAL REQUIREMENTS
    You can code the GUI by hand or use NetBeans GUI builder interface.
    Create a GUI which allows for input and display of student data.
    It should include buttons to save a record, display all records.

    Create a database and table to store student name and three test scores. (Note that average and grade are calculated by app.)

    Student class
    Create a Student class to manage the student data. It should have private instance variables of
    • student name; and
    • three test scores.
    The class must have the following methods.
    • A default and parameterized constructor
    • Sets/gets for all instance variables
    • A get method to calculate and return the average
    • A get method to calculate and return the letter grade
    • toString to display the name of the student

    StudentDB class
    Create a StudentDB class that is used to create a connection and interface with the database.

    This class should have two methods.
    • getAll - reads data from database, returns data in an arraylist of student objects
    • add - writes a record to the database

    GUI class
    Insert button will take the info from the GUI (student name and three test scores) and insert a record into the table.  Input should be cleared from the textboxes.
    Display button will read the data from the database and creates a report in Console window, sample format below.
    Name Test1 Test2 Test3 Avg Grade
    Bruce Wayne  90  95  98  94.3  A
    Clark Kent  65  70  90  75.0  C

    RUBRIC
    Student class
    • Has all required functionality 10
    GUI class
    • Student record can be saved
    • All student data can be displayed 15
    StudentDB class
    • add method inserts a record into db.
    • get method reads all records and returns in arraylist. 15
    Code style 5
    Lab Report 10
    TOTAL 55

    CODE STYLE REQUIREMENTS
    • Include meaningful comments throughout your code.
    • Use meaningful names for variables.
    • Code must be properly indented.
    • Include a comment header at beginning of each file, example below.
    /****************************************************
    Program Name: ProgramName.java
    Programmer's Name: Student Name
    Program Description: Describe here what this program will do
    ***********************************************************/

    DELIVERABLES
    Submit as a SINGLE zip folder
    • all java files; and
    • the Lab report.

    Follow assignment specification regarding class/method names.
    Note that your Java file name must match class name (DO NOT rename).

    Learn More
  4. PRG 421 Week 4 Individual Analyze Assignment Analyzing a Multithreaded Program

    PRG 421 Week 4 Individual Analyze Assignment Analyzing a Multithreaded Program

    Regular Price: $7.00

    Special Price $5.00

    PRG 421 Week 4 Individual Analyze Assignment 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.
    1. Predict the results of executing the program.
    2. Identify whether a deadlock or starvation event will occur and, if so, at what point in the code.

    /**********************************************************************
    * Program: Week 4 Analyze a Multithreaded Program
    * Purpose: Review the code and predict the results for the program execution.
    * Programmer: Iam A. student
    * Instructor: xxx
    ***********************************************************************/
    Package example deadlk;

    public class Deadlock {
    public static Object Lock1 = new Object(); // aacquires lock on the Lock1 object
    public static Object Lock2 = new Object(); // aacquires lock on the Lock2 object
    public static void main(String args[]) {
    ThreadDemo1 T1 = new ThreadDemo1(); // define the new threads
    ThreadDemo2 T2 = new ThreadDemo2(); // and set name for the threads
    T1.start();
    T2.start();
    }

    private static class ThreadDemo1 extends Thread {
    public void run() {
    synchronized (Lock1) {
    // synchronized Lock1 and Lock 2 will hold the thread until release
    System.out.println("Thread 1: Holding lock 1...");
    try { Thread.sleep(10); } // pause for 10 secs, then access thread
    catch (InterruptedException e) {} // if exception happens, “catch it”
    System.out.println("Thread 1: Waiting for lock 2..."); // display wait condition
    synchronized (Lock2) {
    System.out.println("Thread 1: Holding lock 1 & 2...");
    }
    }
    }
    }

    private static class ThreadDemo2 extends Thread {
    public void run() {
    synchronized (Lock2) {
    System.out.println("Thread 2: Holding lock 2...");
    try { Thread.sleep(10); } // pause for 10 secs, then access thread
    catch (InterruptedException e) {} // if exception happens, “catch it”
    System.out.println("Thread 2: Waiting for lock 1..."); // display wait condition
    synchronized (Lock1) {
    System.out.println("Thread 2: Holding lock 1 & 2...");
    }
    }
    }
    }
    }

    Learn More
  5. PRG421 Week 3 Individual Coding Assignment

    PRG 421 Week 3 Individual Coding Assignment

    Regular Price: $10.00

    Special Price $7.00

    PRG 421 Week 3 Individual 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 file, sort and store the contents of the text file into an ArrayList, then write the sorted contents via an output 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 al = new ArrayList ();
     
    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.

    Learn More
  6. PRG 421 Week 1 Individual Analyze Assignment Analyzing a Java Program Containing Abstract and Derived Classes

    PRG 421 Week 1 Individual Analyze Assignment Analyzing a Java Program Containing Abstract and Derived Classes

    Regular Price: $6.00

    Special Price $4.00

    PRG 421 Week 1 Individual Analyze Assignment Analyzing a Java Program Containing Abstract and Derived Classes

    "Analyzing a Java™ Program Containing 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 ("International Customer," "Business Customer," 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. Write your 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?

    Supporting Material: Week One Analyze Assignment Text File
    /**********************************************************************
    * Program: PRG/421 Week 1 Analyze Assignment
    * Purpose: Analyze the coding for an abstract class
    * and two derived classes, including overriding methods
    * Programmer: Iam A. Student
    * Class: PRG/421r13, Java Programming II
    * Instructor:
    * Creation Date: December 13, 2017
    *
    * Comments:
    * Notice that in the abstract Animal class shown here, one method is
    * concrete (the one that returns an animal's name) because all animals can
    * be presumed to have a name. But one method, makeSound(), is declared as
    * abstract, because each concrete animal must define/override the makeSound() method
    * for itself--there is no generic sound that all animals make.
    **********************************************************************/

    package mytest;

    // Animal is an abstract class because "animal" is conceptual
    // for our purposes. We can't declare an instance of the Animal class,
    // but we will be able to declare an instance of any concrete class
    // that derives from the Animal class.
    abstract class Animal {
    // All animals have a name, so store that info here in the superclass.
    // And make it private so that other programmers have to use the
    // getter method to access the name of an animal.

    private final String animalName;
    // One-argument constructor requires a name.
    public Animal(String aName) {
    animalName = aName;
    }

    // Return the name of the animal when requested to do so via this
    // getter method, getName().
    public String getName() {
    return animalName;
    }

    // Declare the makeSound() method abstract, as we have no way of knowing
    // what sound a generic animal would make (in other words, this
    // method MUST be defined differently for each type of animal,
    // so we will not define it here--we will just declare a placeholder
    // method in the animal superclass so that every class that derives from
    // this superclass will need to provide an override method
    // for makeSound()).
    public abstract String makeSound();
    };

    // Create a concrete subclass named "Dog" that inherits from Animal.
    // Because Dog is a concrete class, we can instantiate it.
    class Dog extends Animal {
    // This constructor passes the name of the dog to
    // the Animal superclass to deal with.
    public Dog(String nameOfDog) {
    super(nameOfDog);
    }

    // This method is Dog-specific.
    @Override
    public String makeSound() {
    return ("Woof");
    }
    }

    // Create a concrete subclass named "Cat" that inherits from Animal.
    // Because Cat is a concrete class, we can instantiate it.
    class Cat extends Animal {
    // This constructor passes the name of the cat on to the Animal
    // superclass to deal with.
    public Cat(String nameOfCat) {
    super(nameOfCat);
    }

    // This method is Cat-specific.
    @Override
    public String makeSound() {
    return ("Meow");
    }
    }

    class Bird extends Animal {
    // This constructor passes the name of the bird on to the Animal
    // superclass to deal with.
    public Bird (String nameOfBird) {
    super(nameOfBird);
    }

    // This method is Bird-specific.
    @Override
    public String makeSound() {
    return ("Squawk");
    }
    }

    public class MyTest {
    public static void main(String[] args) {
    // Create an instance of the Dog class, passing it the name "Spot."
    // The variable aDog that we create is of type Animal.
    Animal aDog = new Dog("Spot");
    // Create an instance of the Cat class, passing it the name "Fluffy."
    // The variable aCat that we create is of type Animal.
    Animal aCat = new Cat("Fluffy");
    // Create an instance of (instantiate) the Bird class.
    Animal aBird = new Bird("Tweety");
    //Exercise two different methods of the aDog instance:
    // 1) getName() (which was defined in the abstract Animal class)
    // 2) makeSound() (which was defined in the concrete Dog class)
    System.out.println("The dog named " + aDog.getName() + " will make this sound: " + aDog.makeSound());
    //Exercise two different methods of the aCat instance:
    // 1) getName() (which was defined in the abstract Animal class)
    // 2) makeSound() (which was defined in the concrete Cat class)
    System.out.println("The cat named " + aCat.getName() + " will make this sound: " + aCat.makeSound());
    System.out.println("The bird named " + aBird.getName() + " will make this sound: " + aBird.makeSound());
    }
    }

    Learn More
  7. PRG420 Week 4 Individual Assignment Coding a Program Containing an Array Coding and Output

    PRG420 Week 4 Individual Assignment Coding a Program Containing an Array

    Regular Price: $10.00

    Special Price $7.00

    PRG420 Week 4 Individual Assignment Coding a Program Containing an Array

    Individual: Coding a Program Containing an Array

    Includes Working Java Build and Program File and Explanation of Code
    Resource:  Week Four Coding Assignment Zip File (starter code for this assignment that includes placeholders)
    For this assignment, you will apply what you learned in analyzing a simple Java™ program by writing your own Java™ program that creates and accesses an array of integers. The Java™ program you write should do the following:
    • Create an array to hold 10 integers
    • Ask the user for an integer. Note: This code has already been written for you.
    • Populate the array. Note: The first element should be the integer input by the user. The second through tenth elements should each be the previous element + 100. For example, if the user inputs 10, the first array value should be 10, the second 110, the third 210, and so on.
    • Display the contents of the array on the screen in ascending index order.
    Complete this assignment by doing the following:
    1. Download and unzip the linked Week Four Coding Assignment Zip File.
    2. Read each line of the file carefully, including the detailed instructions at the top.
    3. Add comments to the code by typing your name and the date in the multi-line comment header.
    4. Replace the following lines with Java™ code as directed in the file:
    • LINE 1
    • LINE 2
    • LINE 3
    • LINE 4
    • LINE 5
    5. Comment each line of code you add to explain what you intend the code to do.
    6. Test and modify your Java™ program until it runs without errors and produces the results as described above.
    Note: Refer to this week's analyzing code assignment if you need help.
    Submit your Java source (.java) code file using the Assignment Files tab.

    /********************************************************************
    * Program:    PRG420Week4_CodingAssignment
    * Purpose:       Week 4 Individual Assignment #2
    * Programmer:    Iam A. Student
    * Class:         PRG/420  PRG420 PRG 420
    * Creation Date:   TODAY'S DATE GOES HERE
    *********************************************************************
    *
    *********************************************************************
    *  Program Summary: This program demonstrates these basic Java concepts:
    *     - Creating an array based on user input
    *     - Accessing and displaying elements of the array
    *
    * The program should declare an array to hold 10 integers.
    * The program should then ask the user for an integer.
    * The program should populate the array by assigning the user-input integer
    * to the first element of the array, the value of the first element + 100 to
    * the second element of the array, the value of the second element + 100 to
    * the third element of the array, the value of third element + 100 to
    * the fourth element of the array, and so on until all 10 elements of the
    * array are populated.
    *
    * Then the program should display the values of each of the array
    * elements onscreen. For example, if the user inputs 4, the output
    * should look like this:
    *
    * Enter an integer and hit Return: 4
    * Element at index 0: 4
    * Element at index 1: 104
    * Element at index 2: 204
    * Element at index 3: 304
    * Element at index 4: 404
    * Element at index 5: 504
    * Element at index 6: 604
    * Element at index 7: 704
    * Element at index 8: 804
    * Element at index 9: 904
    ***********************************************************************/
    package prg420week4_codingassignment;
    import java.util.Scanner;
    public class PRG420Week4_CodingAssignment {
     public static void main(String[] args) {
      
      // LINE 1. DECLARE AN ARRAY OF INTEGERS

      // LINE 2. ALLOCATE MEMORY FOR 10 INTEGERS WITHIN THE ARRAY.

      // Create a usable instance of an input device
      Scanner myInputScannerInstance = new Scanner(System.in);
      
      // We will ask a user to type in an integer. Note that in this practice
      // code  WE ARE NOT VERIFYING WHETHER THE USER ACTUALLY
      // TYPES AN INTEGER OR NOT. In a production program, we would
      // need to verify this; for example, by including
      // exception handling code. (As-is, a user can type in XYZ
      // and that will cause an exception.)
      System.out.print("Enter an integer and hit Return: ");
      
      // Convert the user input (which comes in as a string even
      // though we ask the user for an integer) to an integer
      int myFirstArrayElement = Integer.parseInt(myInputScannerInstance.next());
      
      // LINE 3. INITIALIZE THE FIRST ARRAY ELEMENT WITH THE CONVERTED INTEGER myFirstArrayElement
      

      // LINE 4. INITIALIZE THE SECOND THROUGH THE TENTH ELEMENTS BY ADDING 100 TO THE EACH PRECEDING VALUE.
      // EXAMPLE: THE VALUE OF THE SECOND ELEMENT IS THE VALUE OF THE FIRST PLUS 100;
      // THE VALUE OF THE THIRD ELEMENT IS THE VALUE OF THE SECOND PLUS 100; AND SO ON.

      
      // LINE 5. DISPLAY THE VALUES OF EACH ELEMENT OF THE ARRAY IN ASCENDING ORDER BASED ON THE MODEL IN THE TOP-OF-CODE COMMENTS.
      
     } 
    }

    Learn More
  8. CMIS 141 Homework 3 HeadPhones Class

    CMIS 141 Homework 3 HeadPhones Class

    Regular Price: $20.00

    Special Price $15.00

    CMIS 141 Homework 3 HeadPhones Class

    1. (25 points) Create a Java class named HeadPhones to represent a headphone set.
    The class contains:
    - Three constants named LOW, MEDIUM and HIGH with values of 1, 2 and 3 to denote the headphone volume.
    - A private int data field named volume that specifies the volume of the headphone. The default volume is MEDIUM.
    - A private boolean data field named pluggedIn that specifies if the headphone is plugged in. The default value if false.
    - A private String data field named manufacturer that specifies the name of the manufacturer of the headphones.
    - A private Color data field named headPhoneColor that specifies the color of the headphones.
    - getter and setter methods for all data fields.
    - A no argument constructor that creates a default headphone.
    - A method named toString() that returns a string describing the current field values of the headphones.
    - A method named changeVolume(value) that changes the volume of the headphone to the value passed into the method
    Create a TestHeadPhones class that constructs at least 3 HeadPhones objects. For each of the objects constructed, demonstrate the use of each of the methods. Be sure to use your IDE to accomplish this assignment.

    2. (25 points) Create your own Java class that represents your favorite musical instrument. Your musical instrument class should have at least 3 constants, 4 private data fields, getters and setters for each private data field, a toString() method, and two additional methods of your choice.
    Create a test class that constructs at least 3 of your musical instrument objects. For each of the objects constructed demonstrate the use of each of the methods. Be sure to use your IDE to accomplish this assignment. You can pick any instrument you want. When designing your class, think about what would make sense to describe and use the instrument.
    For example, if you selected a trumpet, you might need to provide the number of valves, the manufacturer, if the instrument is using a mute, and the volume or even notes the trumpet is playing. Make this your own creation and have fun with it.

    Learn More
  9. Penn foster Graded Project 3 Cell-based Board Games Java

    Penn foster Graded Project 3 Cell-based Board Games Java

    Regular Price: $20.00

    Special Price $15.00

    Penn foster Graded Project 3 Cell-based Board Games Java

    In this project, you'll create data types in a class structure for cell-based board games similar to Tic-Tac-Toe. Games like Connect Four and Mastermind also use boards divided by rows and columns. The Board and Cell classes represent the board, while the Player, Mark, and Outcome enumerations track the game.
    You’ll use the classes and enumerations created in this project in future graded projects. You use the NetBeans project in the next lesson

    INSTRUCTIONS
    1. In NetBeans, create a new Java Application project named BoardGameTester.
    2. Create a new package named games and a sub-package of games named board. The easiest way is simply to create a package named games.board.
    3. Add an enumeration named Player to the games.board package. You could add Empty Java File or choose Java Enum as the file type. This enumeration represents the current player in a turn-based game. Use the following code:
    public enum Player {FIRST,SECOND}
    Note: Although Tic-Tac-Toe and Mastermind allow only two players, Connect Four can be played with up to four players. For simplicity, our code will handle only two players.
    4. Add an enumeration named Outcome to the games.board package. This enumeration represents the result when the turn is completed. Use the following code:
    public enum Outcome {PLAYER1_WIN, PLAYER2_WIN, CONTINUE, TIE}
    5. Add an enumeration named Mark to the games.board package. This enumeration represents the result when the game is completed. Use the following code:
    public enum Mark {EMPTY, NOUGHT, CROSS, YELLOW, RED, BLUE, GREEN, MAGENTA, ORANGE}
    Keep in mind that only yellow and red are used in Connect Four, while Mastermind uses all six colors.
    6. Add the Cell class to the games.board package. It should have the private variables content, row, and column, and the public methods getContent, setContent, getRow, and getColumn. Use the following code as a guide:
    public class Cell {
    private Mark content;
    private int row, column;
    public Cell(int row, int column) {
    this.row = row;
    this.column = column;
    content = Mark.EMPTY;
    }
    public Mark getContent() { return content; }
    public void setContent(Mark content) { this.content = content;
    }
    public int getRow() { return row; }
    public int getColumn() { return column; }
    }
    Take note that all classes that support direct instantiation should have a constructor. In this case, the constructor will be used by the Board class to create each of its cells.
    7. Add the Board class to the games.board package. It should have a two-dimensional array of Cell objects. The Board class should initialize a board with a specified number of columns and rows, provide access to Cell objects, and display all of its cells correctly. Use the following code as a guide:
    public class Board {
    private Cell[][] cells;
    public Board(int rows, int columns) {
    cells = new Cell[rows][columns];
    for( int r = 0; r < cells[0].length; r++) {
    for (int c = 0; c < cells[1].length;c++) {
    cells[r][c] = new Cell(r,c);
    }
    }
    }
    public void setCell(Mark mark, int row, int
    column) throws IllegalArgumentException {
    if (cells[row][column].getContent() == Mark.EMPTY)
    cells[row][column].setContent(mark);
    else throw new IllegalArgumentException("Player already there!");
    }
    public Cell getCell(int row, int column) {
    return cells[row][column];
    }
    public String toString() {
    StringBuilder str = new StringBuilder();
    for( int r = 0; r < cells.length; r++ ) {
    str.append("|");
    for (int c = 0; c < cells[r].length; c++) {
    switch(cells[r][c].getContent())
    {
    case NOUGHT:
    str.append("O");
    break;
    case CROSS:
    str.append("X");
    break;
    case YELLOW:
    str.append("Y");
    break;
    case RED:
    str.append("R");
    break;
    case BLUE:
    str.append("B");
    break;
    case GREEN:
    str.append("G");
    break;
    case MAGENTA:
    str.append("M");
    break;
    case ORANGE:
    str.append("M");
    break;
    default: //Empty
    str.append(" ");
    }
    str.append("|");
    }
    str.append("\n");
    }
    return str.toString();
    }
    }

    This code should seem familiar to you. The methods in the TicTacToeGame class are similar to those in the Board class. The StringBuilder class was used instead of the String class for better performance. You can learn more about the StringBuilder class by visiting the Oracle Website at http://docs.oracle.com/javase/tutorial/java/data/buffers.html.

    8. Add the following import statement to the BoardGameTester class:
    import games.boards.*;

    9. In the main() method of BoardGameTester, perform the following actions:
    a. Create a 3 × 3 board for a Tic-Tac-Toe game.
    b. Create a 6 × 7 board for a Connect Four game.
    c. Create a 5 × 8 board for a game of Mastermind.
    d. Set a cell to a nought or cross on the Tic-Tac-Toe board.
    e. Set a cell to yellow or red on the Connect Four board.
    f. Set a cell to yellow, red, green, blue, magenta, or orange on the Mastermind board.
    g. Display the boards for Tic-Tac-Toe, Connect Four, and Mastermind.

    10. Compile and run the project to ensure it works as you expected it to.

    Learn More
  10. CSC 275 Assignment 2 Flower Pack

    CSC 275 Assignment 2 Flower Pack

    Regular Price: $20.00

    Special Price $15.00

    CSC 275 Assignment 2 Flower Pack

    Now that we've helped out our friend and his sister they have invited us over for dinner to talk about what improvements can be made. We find out many things about the young boy, we even find out that his name is Alexander and his sister’s name is Elizabeth. Elizabeth tells us a about the day of her accident when she was climbing a tree and a branch broke causing her to fall to the ground giving her these near fatal wounds leaving her bed-ridden. Finally, we start talking about the improvements they would like made to make Elizabeth’s life a little happier.
    Alexander finds himself searching through his pack for specific traits of a flower. Some days Elizabeth wants only red flowers or only flowers with thorns as she likes to peel them off. Surely we can help them out!
    • Create a flower object that has specific traits (name, color, presence of thorns and smell)
    • These flower objects must be able to stay in his pack (Use an array of length 25)
    • Be able to add, remove and search these flowers – by name and traits (We can drop the sorting for now)

    Using the same code as assignment 1 you can make your changes. I have included some base code for your convenience (This is 2 classes, Assignment2 and Flower).
    import java.util.Scanner;
    public class Assignment2 {
    public static void main(String[] args) {
    new Assignment2();
    }
    // This will act as our program switchboard
    public Assignment2() {
    Scanner input = new Scanner(System.in);
    Flower[] flowerPack = new Flower[25];
    System.out.println("Welcome to my flower pack interface.");
    System.out.println("Please select a number from the options below");
    System.out.println("");
    while (true) {
    // Give the user a list of their options
    System.out.println("1: Add an item to the pack.");
    System.out.println("2: Remove an item from the pack.");
    System.out.println("3: Search for a flower.");
    System.out.println("4: Display the flowers in the pack.");
    System.out.println("0: Exit the flower pack interfact.");
    // Get the user input
    int userChoice = input.nextInt();
    switch (userChoice) {
    case 1:
    addFlower(flowerPack);
    break;
    case 2:
    removeFlower(flowerPack);
    break;
    case 3:
    searchFlowers(flowerPack);
    break;
    case 4:
    displayFlowers(flowerPack);
    break;
    case 0:
    System.out
    .println("Thank you for using the flower pack interface. See you again soon!");
    System.exit(0);
    }
    }
    }

    private void addFlower(Flower flowerPack[]) {
    // TODO: Add a flower that is specified by the user
    }

    private void removeFlower(Flower flowerPack[]) {
    // TODO: Remove a flower that is specified by the user
    }

    private void searchFlowers(Flower flowerPack[]) {
    // TODO: Search for a user specified flower
    }

    private void displayFlowers(Flower flowerPack[]) {
    // TODO: Display only the unique flowers along with a count of any
    // duplicates
    /*
    * For example it should say Roses - 7 Daffodils - 3 Violets - 5
    */
    }
    }

    // This should be in its own file
    public class Flower {
    // Declare attributes here
    public Flower(){
    }
    // Create an overridden constructor here
    //Create accessors and mutators for your traits.
    }

    Learn More

Items 1 to 10 of 15 total

per page
Page:
  1. 1
  2. 2

Grid  List 

Set Ascending Direction
[profiler]
Memory usage: real: 14942208, emalloc: 14375216
Code ProfilerTimeCntEmallocRealMem