Welcome to AssignmentCache!

Search results for 'microsoft access Walburg'

Items 1 to 10 of 17 total

per page
Page:
  1. 1
  2. 2

Grid  List 

Set Descending Direction
  1. CIS355A iLab 4 Step 2 InheritanceTest Java Programs

    CIS355A iLab 4 InheritanceTest DayGui and OfficeAreaCalculator Java Programs

    $15.00

    CIS355A iLab 4 InheritanceTest DayGui and OfficeAreaCalculator Java Programs

    In this lab, you will create one project that uses inheritance and two simple Graphical User Interfaces (GUI) programs.

    Deliverables
    Program files for each of the following three programs
    1. InheritanceTest
    2. DayGui
    3. OfficeAreaCalculator

    iLAB STEPS
    STEP 1: InheritanceTest (20 points)
    Write a program called InheritanceTest.java to support an inheritance hierarchy for class Point-Square-Cube. Use Point as the superclass of the hierarchy. Specify the instance variables and methods for each class. The private variable of Point should be the x-y coordinates. The private data of Square should be the sideLength. The private data of Cube should be depth. Each class must provide applicable accessor, mutator, and toString() methods for manipulating private variables of each corresponding class. In addition, the Square class must provide the area() and perimeter() methods. The Cube must provide the area() and volume() methods.
    Write a program that instantiates objects of your classes, ask the user to enter the value for x, y, and sideLength, test all instance methods and outputs of each object’s perimeter, area, and volume when appropriate.

    STEP 2: DayGui (10 points)
    Write a program called DayGui.java that creates a GUI having the following properties
    Object Property Setting
    JFrame Name Caption Layout mainFrame Messages FlowLayout
    JButton Name Caption Mnemonic cmdGood Good G
    JButton Name Caption Mnemonic cmdBad Bad B
    Add individual event handlers to your program so that when a user clicks the Good button, the message "Today is a good day!" appears in a dialog box, and when the Bad button is clicked, the message "I'm having a bad day today!" is displayed. The following tutorial shows you much of the code solution. Feel free to use the tutorial, but make changes so that you are not simply copying the tutorial code for your entire solution. To make this different from the tutorial, change the colors of the buttons and panel. Also, add this application to a tabbed pane along with the program you will complete in the next step, Step 3. The following tutorials will likely be useful as you work to complete this step:
    • JTabbedPane
    • Tutorial to Write Your First GUI

    STEP 3: OfficeAreaCalculator (10 points)
    Write a program called OfficeAreaCalculator.java that displays the following prompts using two label components
    • Enter the length of the office:
    • Enter the width of the office:
    Have your program accept the user input in two text fields. When a button is clicked, your program should calculate the area of the office and display the area in a text field with a label of Area. This display should be cleared whenever the input text fields receive the focus. A second button should be provided to terminate the application (Exit button).
    The following tutorial shows you much of the code solution. Feel free to use the tutorial, but make changes so that you are not simply copying the tutorial code for your entire solution. To make this different from the tutorial, change the colors of the panel. Also, add this application to the same tabbed pane (see the JTabbedPane tutorial) as the application you built in Step 2, the DayGui application.
    • Office Area Calculator Tutorial

    Learn More
  2. ITS 320 Program 3 Exercise 5.17 Java

    ITS 320 Assignment 3 Decision Control and Loops with User Interaction

    $15.00

    ITS 320 Assignment 3 Decision Control and Loops with User Interaction

    1) Write a Java application that prompts the user for pairs of inputs of a product number (1-5), and then an integer quantity of units sold (this is two separate prompts for input values). You must use a switch statement and a sentinel – controlled loop (i.e. a loop that stops execution when an out of range value, such as -1, is input). All 15 items below are for a single purchase. There are five sets of inputs as follows:
    Product 1 1 unit (cost is $2.98 per unit)
    Product 2 2 units (cost is $4.50 per unit)
    Product 3 3 units (cost is $9.98 per unit
    Product 4 4 units (cost is $4.49 per unit)
    Product 5 5 units (cost is $6.87 per unit)
    Your application must calculate and display the total retail value of all products sold, after all 5 pairs of inputs are completed. You must also display the total after each new pair of input values is entered. (This program was taken from Exercise 5.17 on page 228 of Deitel & Deitel's "Java How to Program (Sixth Edition)" (2005 by Pearson Publishing Co.))

    2) You may use the Windows Command Prompt command line interface or any Java IDE you choose to compile and execute your program.

    3) You are to submit the following deliverables to the Assignment Dropbox in a single Microsoft Word file:
    A screen snapshot of your Java source code (just the beginning is OK) as it appears in your IDE (e.g. jGRASP, Net Beans, Eclipse, etc.) or editor (e.g. a Windows Command Prompt DOS "more" of the .java file's first screen).
    A listing of your entire Java source code in the same Microsoft Word file as item a), and following item a). You can simply copy and paste the text from your IDE into Word. Be sure to maintain proper code alignment by using Courier font for this item.
    A screen snapshot of your program’s input and output in the same Microsoft Word file, and following item b). You must include screen snapshots of all inputs and all outputs,not just a sample.

    4) Your instructor may compile and run your program to verify that it compiles and executes properly.

    5) You will be evaluated on (in order of importance):
    Inclusion of all deliverables in Step #3.
    Correct execution of your program.
    Adequate commenting of your code.
    Good programming style (as specified in the textbook's examples).
    Neatness in packaging and labeling of your deliverables

    Learn More
  3. ITS 320 Java Program 2 BankAccount Class Output

    ITS 320 Java Program 2 Custom BankAccount Class with a Modified Constructor

    $15.00

    ITS 320 Java Program 2 Custom BankAccount Class with a Modified Constructor

    1) Enter the code for the two classes "BankAccount.java" and "Program2.java" shown below. The Program2 class is a driver for the BankAccount class. Note that this version of the BankAccount class accepts a monthly interest rate in decimal format which must be calculated by the user.
    /**
    * BankAccount class
    * This class simulates a bank account.
    *
    * (Taken from "Starting Out with Java - Early Objects
    * (Third Edition) by Tony Gaddis, 2008 by Pearson Educ.)
    *
    */
    public class BankAccount
    {
    private double balance; // Account balance
    private double interestRate; // Interest rate
    private double interest; // Interest earned

    /**
    * The constructor initializes the balance
    * and interestRate fields with the values
    * passed to startBalance and intRate. The
    * interest field is assigned to 0.0.
    */
    public BankAccount(double startBalance,
    double intRate)
    {
    balance = startBalance;
    interestRate = intRate;
    interest = 0.0;
    }

    /**
    * The deposit method adds the parameter
    * amount to the balance field.
    */
    public void deposit(double amount)
    {
    balance += amount;
    }

    /**
    * The withdraw method subtracts the
    * parameter amount from the balance
    * field.
    */
    public void withdraw(double amount)
    {
    balance -= amount;
    }

    /**
    * The addInterest method adds the interest
    * for the month to the balance field.
    */
    public void addInterest()
    {
    interest = balance * interestRate;
    balance += interest;
    }

    /**
    * The getBalance method returns the
    * value in the balance field.
    */
    public double getBalance()
    {
    return balance;
    }

    /**
    * The getInterest method returns the
    * value in the interest field.
    */
    public double getInterest()
    {
    return interest;
    }
    }

    /**
    *
    * Colorado State University – ITS-320 – Basic Programming
    *
    * This program demonstrates the BankAccount class.
    *
    * (Taken from "Starting Out with Java - Early Objects
    * (Third Edition) by Tony Gaddis, 2008 by Pearson Educ.)
    *
    * Programmed by: Reggie Haseltine, instructor
    *
    * Date: June 19, 2010
    *
    */
    import java.util.Scanner; // Needed for the Scanner class
    import java.text.DecimalFormat; // Needed for 2 decimal place amounts
    public class Program2 {
    public static void main(String[] args)
    {
    BankAccount account; // To reference a BankAccount object
    double balance, // The account's starting balance
    interestRate, // The annual interest rate
    pay, // The user's pay
    cashNeeded; // The amount of cash to withdraw

    // Create a Scanner object for keyboard input.
    Scanner keyboard = new Scanner(System.in);

    // Create an object for dollars and cents
    DecimalFormat formatter = new DecimalFormat ("#0.00");

    // Get the starting balance.
    System.out.print("What is your account's " + "starting balance? ");
    balance = keyboard.nextDouble();

    // Get the monthly interest rate.
    System.out.print("What is your monthly interest rate? ");
    interestRate = keyboard.nextDouble();

    // Create a BankAccount object.
    account = new BankAccount(balance, interestRate);

    // Get the amount of pay for the month.
    System.out.print("How much were you paid this month? ");
    pay = keyboard.nextDouble();

    // Deposit the user's pay into the account.
    System.out.println("We will deposit your pay " + "into your account.");
    account.deposit(pay);
    System.out.println("Your current balance is $" + formatter.format( account.getBalance() ));

    // Withdraw some cash from the account.
    System.out.print("How much would you like " + "to withdraw? ");
    cashNeeded = keyboard.nextDouble();
    account.withdraw(cashNeeded);

    // Add the monthly interest to the account.
    account.addInterest();

    // Display the interest earned and the balance.
    System.out.println("This month you have earned $" + formatter.format( account.getInterest() ) + " in interest.");
    System.out.println("Now your balance is $" + formatter.format( account.getBalance() ) );
    }
    }

    Compile the two test files (BankAccount.java first and then Program2.java second). Execute Program2 with the following inputs:
    starting balance - $500 (don't enter the dollar sign)
    monthly interest rate - 0.00125 (this is a 1.5% annual rate)
    monthly pay - $1000 (don't enter the dollar sign)
    withdrawal amount - $900 (don't enter the dollar sign)
    Verify that you earn $0.75 in interest and have an ending balance at the end of the month of $600.75.

    Then modify the BankAccount class's constructor method to create a BankAccount object which stores a monthly interest when the user inputs an annual interest rate of the format "nnn.nn" (i.e. 1.5). Note that the BankAccount constructor stored a monthly interest rate for the BankAccount object's instance field originally, but the user had to convert the annual rate to a monthly rate (i.e. 1.5 to 0.00125). Then modify the Program2 driver class to prompt the user for an annual interest rate. Recompile both classes and execute the modified Program2 driver class again, this time with following inputs:
    starting balance - $500 (don't enter the dollar sign)
    annual interest rate - 1.5
    monthly pay - $1000 (don't enter the dollar sign)
    withdrawal amount - $900 (don't enter the dollar sign)
    Verify that you still earn $0.75 in interest and still have an ending balance at the end of the month of $600.75 as you did with the original code.

    Submit only the modified source code files, final user inputs, and final output. Do not submit the original source code, inputs, and output.

    Be sure that you include the course, the program number, your name, and the date in your program header. Also include this information at the top of your Microsoft Word file. Include additional comments as necessary and maintain consistent indentation for good programming style as shown and discussed in our text.

    2) You may use the Windows Command Prompt command line interface or any Java IDE you choose to compile and execute your program.

    3) You are to submit the following deliverables to the Dropbox:
    a) A single Microsoft Word file containing a screen snapshot of your Java source code for both Program2.java and BankAccount.java (just the beginnings of the source code is OK) as it appears in your IDE (e.g. jGRASP, Net Beans, JDeveloper, etc.) or editor (e.g. a DOS "more" of the .java file's first screen).
    b) A listing of your entire modified version of the Java source code for Program2.java and BankAccount.java in the same Microsoft Word file as item a), and following item a).
    You can simply copy and paste the text from your IDE into Word. Be sure to maintain proper code alignment by using Courier font for this item. Do not submit the original source code files! c) A screen snapshot showing all of your program’s inputs and output in the same Microsoft Word file, and following item b) above.

    4) Your instructor may compile and run your program to verify that it compiles and executes properly.

    5) You will be evaluated on (in order of importance):
    a) Inclusion of all deliverables in Step #3 in a single Word file.
    b) Correct execution of your program. This includes getting the correct results with the modified class files!
    c) Adequate commenting of your code.
    d) Good programming style (as shown and discussed in the textbook's examples).
    e) Neatness in packaging and labeling of your deliverables.

    6) You must put all your screen snapshots and source code to a single Microsoft Word file.

    Learn More
  4. Employee Online Time Clock Project

    Employee Online Time Clock Project

    $25.00

    Employee Online Time Clock Project

    Overview
    The final project for this course is the creation of an Online Time Clock. The final project is designed to allow you to put together the concepts learned in the course and to demonstrate your ability to write a useful Java program. The final project is given early in the course so that you will have plenty of time to design the program before it is due.
    Early in the course, you will not have the knowledge to implement many of the required elements, but you will still be able to move your project forward by designing it at the conceptual level. Diagramming and pseudo coding before coding a project allows you to think through what needs to be done in detail, thus allowing you to see design flaws before they have been coded. The extra effort to design the program before coding will make the coding process much easier and will result in fewer bugs. The project specifications include a list of requirements that demonstrate different areas of Java development that must be included in your final project to demonstrate your skill in that area. The project shall demonstrate the following skills:
    • Use of a static member
    • Use of extended class
    • Code Commenting
    • GUI or Console based interface
    • Use of public and private methods
    • Use at least one overloaded constructor
    • Create instances of class(es)
    • Use the 'this' reference
    • Optional: Exception handling using try/throw/catch/finally

    The project is divided in to Six Milestones, which will be submitted at various points throughout the course to scaffold learning and ensure quality final submissions. These milestones will be submitted in Modules Four, Six, Seven, Eight, Nine, and Ten.

    Main Elements

    Approach Blueprint
    Coding a project of this size requires some planning and time. Work on building a blueprint for the program throughout the term. Having a blueprint will make the coding simpler and keep you from going down dead ends. Some important things to work on early:
    • If the application is using more than one screen (console applications have no choice.), what is the flow between screens? A flow chart that covers all of the possible screen access possibilities will avoid logic problems in the application.
    • Break the program down into a set of classes that will work together to execute the program. Object oriented programs are easier to write than structured programs because each class has one set of functionality that it does well and working on one piece at a time makes the programming easier. List out the properties and methods that each class will use so that the relationship between the classes can be established. (Software Engineers create formal class diagrams that show the class hierarchy of a program and how they interrelate. A formal class diagram is not required for this project, but sketching a rough diagram will make things easier.)
    • Optional: Error handling can have unexpected results if not done correctly. Diagram how your exception handling will work by sketching a flow chart.
    • Validation can be as tricky as error handling, so sketching a diagram is also useful.
    • Devise a strategy for handling data. The data may be held in objects in memory, or, optionally, in text files. If you decide to use memory objects, then there should be separate objects for Employee information and their time clock records. The employee memory object (or employee.txt flat file) will be relatively simple since there are no deletes or modifications to an input value. Employees will be employee ID order. The time clock memory object (or timeclock.txt file) is a different story because the records will not be in employee ID order; they will be in the order that an employee punched in or out. When generating a report it will be necessary to find all of the data for each employee and output it in chronological order. The chronological order is already in the memory object (or file) because we are not deleting or modifying any data. The program will only need to group all of the data for an employee together. This can be done in several ways (You may choose which is best, or come up with another solution):
    o When an employee punches in or out the program can search the data file and insert the value after the last entry for that employee.
    o The system can sort the values in the file in memory as part of the reporting functionality, leaving the data in the file in its original order.

    Caution is in order because the records should have the punch in time and punch out time for a single day in order. (They will be in that order in the file, because someone has to punch in before they punch out. The program specifications require checking for a 'punched in' record before saving a 'punched out' record.)
    NOTE: The separate screen descriptions are for console applications. The GUI application may use one or more screens, as appropriate, but the functionality shall remain the same).
    NOTE: Functionality labeled as Optional does not have to be implemented. It is for students who would like to write a more challenging program.
    NOTE: Those developing a GUI application will replace the 'input values' with appropriate GUI objects such as buttons. For example, instead of inputting 'A' for Add New Employee, create a button for adding a new employee.

    Scenario
    A company hires you to write a program to track hourly employee arrival and departure times from work. In essence, you are tasked to make an online time clock. The time clock shall keep a history of an employee’s hours for a two-week pay period. The application shall have the following functionality:

    Main Screen
    The main screen shall act as a menu to access program functionality and to exit the program.
    The main screen shall:
    • Display 4 options
    A) Add New Employee – Displays new employee screen
    B) Punch In/Out – Displays punch in/out screen
    C) Report – Displays report screen
    D) Exit – Exits the program
    • Display an input field called "Choice" to input one of the four options.
    • Inputting an incorrect option shall display a prompt indicating that the input was invalid and to try again.
    • Optional functionality: If the user enters an incorrect value more than 3 times, display a prompt that the program is exiting and close the program.

    Add New Employee Screen
    The 'add new employee screen' shall:
    • Add a new employee (we will not worry about modifying or deleting.), saving the data to a memory object or file.
    o The program shall allow the user to enter the Employee’s First and Last Name
    o The program shall validate the first and last name entered to ensure they are not blank. (We will assume that everyone has a first and last name.)
    o The program shall assign a new employee ID to the employee and display it on the screen.
    o The employee ID shall be generated by adding 1 to the largest employee ID already in the employee memory object (or employee.txt data file).
    o The program shall allow the user to enter an unlimited number of employees. In console based applications, the system shall prompt “Do you want to enter another? (y/n). Entering 'y' shall clear the screen and prompt for another employee. If 'n', the program shall return to the main screen.
    o The employee data shall be saved to a memory object called employee (or file called employee.txt)
    o Optional functionality: Check the first and last name to ensure that there are only valid characters. For examples, filter out numbers, punctuation, etc. Commas can cause problems because the data is being saved to comma-delimited files and that can be a headache!

    Punch in/out Screen
    The 'punch in/out screen' shall:
    • Save the punch in or punch out date and time of the employee to a memory object (or file).
    o The date and time, 'I' for Punched In or 'O' for punched out along with the Employee ID shall be saved to a memory object called timeclock (or file called timeclock.txt).
    o The recorded date for 'punched in' and 'punched out' shall be the method for matching corresponding records.
    o The program shall test to ensure that there is a 'Punched in' record for the corresponding day before a 'punched out' record is saved. If none is found, prompt the user to enter a 'punched in' time.
    o Then the user has punched in or out, the program shall display a message indicating that the employee has punched in or out, the employee ID, date and time.
    o In console based applications the screen shall display "Press any key to continue"
    o In console based applications the program shall return to the main menu after a key is pressed when the “Press any key to continue” prompt is displayed.
    o Optional functionality: Add the day of the week to the data saved.

    Report Screen (Hint: If you are writing a console application, java.io.PrintWriter may be useful.)
    The 'report screen' shall:
    • Allow the user to display a work history report for an individual or for all employees for the two weeks prior to the report request.
    o The screen shall display a prompt to enter 'I' for individual employee report, 'A' for all employees report.
    o If the selected value is 'I', prompt the user to enter the employee's ID number.
     If 'I' is selected the display shall show the employee's name and ID, list out each day worked in chronological order, the number of hours worked that day and a total number of hours worked in the two week period.
     The report shall prompt the user to re-enter an employee ID of it does not exist in the employee file.
     Optional Functionality: If the user inputs a nonexistent employee ID more than 3 times, prompt the user and then return to the main screen.
    o If the selected value is 'A', output the information to the console for the past two weeks.
    o The end of the report shall display "Press any key to continue" to return to the main menu.
    o Optional Functionality: Allow the user to print the report to a printer.

    Example Screen Shots
    The following screen shots are suggestions for setting up your application. You are not required to make your screens look like these, they are only provided to help you think about the program’s interface. Items that are inside a red box are some example prompts that may not be displayed unless a particular action takes place. You may have more or different prompts depending on how you decide to create your program.
    Console Based Application

    GUI Base Application Using One Screen (You are free to use multiple screens, if desired.)

    Learn More
  5. CIS355A Week 5 iLab 5 Step 1 Write Clients to File

    CIS355A Week 5 iLab GUI Graphics and File I/O

    Regular Price: $25.00

    Special Price $20.00

    CIS355A Week 5 iLab GUI Graphics and File I/O

    Scenario/Summary
    In this lab, you will create one project that reads from a file, one project that writes to a file, and one project drawing a snowman.

    iLAB STEPS
    STEP 1: Writing out Client Information
    1) Create the following GUI, so that when your program is running, your user can input information regarding a client and hit the save button to save the information out to a file.
    2) Every time the user hits the save button, that information should be saved out to a file called client.txt; each new client's information should append to the information already saved onto the file client.txt.
    3) The data in the client.txt file should be formatted like the following.
    Client Activity Report
    Client Name Client ID Starting Balance Closing Balance
    XXXXXXXXX 9999999 99999.99 99999.99
    XXXXXXXXX 9999999 99999.99 99999.99
    XXXXXXXXX 9999999 99999.99 99999.99

    STEP 2: Reading in Client Information
    1) Create a class called Client, the Client class must contain attributes for Client name, Client ID, starting balance, and closing balance, and all other accessor/mutator/constructor functions as necessary.
    2) Assume you have a client.txt file with the following sample information.
    Charles Smith|100235|5700.75|1200.00
    James Peterson|320056|349.56|4005.56
    Francis Lewis|400556|7500.00|456.23
    William Burgess|45399|5000.00|1245.56
    Philip Wilson|10090|10000.00|2300.75
    James Brown|34291|25000.45|31454.86
    3) Create a Client ArrayList to process input records in main().
    4) Use a for loop to read in the information from client.txt.
    5) The GUI to this program should look similar to this:
    6) Once the user hits the display button, everything read in from the file should display in the Console window in this format.
    Client Activity Report
    Client Name Client ID Starting Balance Closing Balance
    XXXXXXXXX 9999999 99999.99 99999.99
    XXXXXXXXX 9999999 99999.99 99999.99
    XXXXXXXXX 9999999 99999.99 99999.99

    STEP 3: Snowman!
    Use the many draw methods provided to you by Java and draw a Snowman—be as creative or as basic as you would like, as long as the final result resembles a snowman. It doesn't have to necessarily look exactly like this, but this is the minimum you should achieve with your drawing.
    1) You must have at least three circles in your project.
    2) You must have at least a line, a polygon, an oval, or a rectangle.
    3) In addition to your snowman, you should also use drawString to draw some text.
    4) Use draw or fill and the color class as you see fit.
    Hint: frame.getContentPane().setBackground(Color.blue); //This is the code you need to set the frame's background color. Have Fun!

    Learn More
  6. 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
  7. 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
  8. Penn foster Graded Project 4 BoardGameTester application Java

    Penn foster Graded Project 4 BoardGameTester application Java

    Regular Price: $20.00

    Special Price $15.00

    Penn foster Graded Project 4 BoardGameTester application Java

    In this project, you'll modify the BoardGameTester application to save the gameboard to a file. You'll perform the file writing process on a separate thread.

    INSTRUCTIONS
    1. In NetBeans, open the BoardGameTester project.
    2. Create a new package named games.utilities.
    3. Add a public class named FileManager that contains the following methods:
    public static void writeToFile(String saveState, String fileName) {
    //TODO: Write a string to a new file synchronously
    }
    public static void writeToFileAsync(final String saveState, final String fileName) {
    //TODO: Write a string to a new file asynchronously
    }
    4. Implement the writeToFile method using the new file I/O classes in a try-with-resources statement.
    Note: Use the code in Activity 15 as a guide for the writeToFile method. Remember to import the java.io, java.nio, java.nio.charset, and java.nio.file packages.
    5. Implement the writeToFileAsync method using a separate thread. Use the following code as a guide:
    new Thread() {
    public void run() {
    writeToFile(saveState, fileName);
    }
    }.start();
    Note: This code uses an anonymous inner class to declare and instantiate a Thread class. Unlike a traditional inner class, anonymous inner classes are available only within the statement they're declared. You'll see more examples of anonymous classes with Swing in the next lesson. To ensure that local variables are unchanged by the inner class, the parameters saveState and fileName must be declared with the final keyword.
    6. In the main() method of the BoardGameTester project, add the following code:
    FileManager.writeToFileAsync(ticTacToe.toString(), "ttt.txt");
    FileManager.writeToFileAsync(connectFour.toString(), "c4.txt");
    FileManager.writeToFileAsync(mastermind.toString(), "mm.txt");
    7. Compile and run the project to create three files, one for each saved board game. Open the files to ensure they contain the correct game board display.
    Note: Notepad won’t display the line returns in the file. You may need to open the text files using Microsoft Word or Wordpad instead.
    These three game board files will be required for submission.

    Learn More
  9. 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
  10. 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

Items 1 to 10 of 17 total

per page
Page:
  1. 1
  2. 2

Grid  List 

Set Descending Direction
[profiler]
Memory usage: real: 15466496, emalloc: 14798264
Code ProfilerTimeCntEmallocRealMem