Java

Need Help in Java Assignment?
We can help you if you are having difficulty with your Java Assignment. Just email your Java Assignment at admin@assignmentcache.com.
We provide help for students all over the world in Java Assignment.

Items 41 to 50 of 109 total

per page
Page:
  1. 3
  2. 4
  3. 5
  4. 6
  5. 7

Grid  List 

Set Ascending Direction
  1. 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
  2. PRG421 Week 1 Individual Coding Assignment Object-Oriented Programming Concepts

    PRG421 Week 1 Individual Coding Assignment Object-Oriented Programming Concepts

    Regular Price: $10.00

    Special Price: $7.00

    PRG421 Week 1 Individual Coding Assignment Object-Oriented Programming Concepts


    For this assignment, you will modify existing code to create a single Java™ program named BicycleDemo.java that incorporates the following:


    An abstract Bicycle class that contains private data relevant to all types of bicycles (cadence, speed, and gear) in addition to one new static variable: bicycleCount. The private data must be made visible via public getter and setter methods; the static variable must be set/manipulated in the Bicycle constructor and made visible via a public getter method.
    Two concrete classes named MountainBike and RoadBike, both of which derive from the abstract Bicycle class and both of which add their own class-specific data and getter/setter methods.


    Read through the "Lesson: Object-Oriented Programming Concepts" on The Java™ Tutorials website.
    Download the linked Bicycle class, or cut-and-paste it at the top of a new Java™ project named BicycleDemo.
    Download the linked BicycleDemo class, or cut-and-paste it beneath the Bicycle class in the BicycleDemo.java file.
    Optionally, review this week's Individual "Week One Analyze Assignment," to refresh your understanding of how to code derived classes.


    Adapt the Bicycle class by cutting and pasting the class into the NetBeans editor and completing the following:
    Change the Bicycle class to be an abstract class.
    Add a private variable of type integer named bicycleCount, and initialize this variable to 0.
    Change the Bicycle constructor to add 1 to the bicycleCount each time a new object of type Bicycle is created.
    Add a public getter method to return the current value of bicycleCount.
    Derive two classes from Bicycle: MountainBike and RoadBike. To the MountainBike class, add the private variables tireTread (String) and mountainRating (int). To the RoadBike class, add the private variable maximumMPH (int).
    Using the NetBeans editor, adapt the BicycleDemo class as follows:
    Create two instances each of MountainBike and RoadBike.
    Display the value of bicycleCount on the console.
    Comment each line of code you add to explain what you added and why. Be sure to include a header comment that includes the name of the program, your name, PRG/421, and the date.
    Rename your JAVA file to have a .txt file extension.
    Submit your TXT file to the Assignment Files tab.


    package bicycledemo;


    class Bicycle {
    int cadence = 0;
    int speed = 0;
    int gear = 1;


    void changeCadence(int newValue) {
    cadence = newValue;
    }


    void changeGear(int newValue) {
    gear = newValue;
    }


    void speedUp(int increment) {
    speed = speed + increment;  
    }


    void applyBrakes(int decrement) {
    speed = speed - decrement;
    }


    void printStates() {
    System.out.println("cadence:" +
    cadence + " speed:" +
    speed + " gear:" + gear);
    }
    }
    class BicycleDemo {
    public static void main(String[] args) {


    // Create two different
    // Bicycle objects
    Bicycle bike1 = new Bicycle();
    Bicycle bike2 = new Bicycle();


    // Invoke methods on
    // those objects
    bike1.changeCadence(50);
    bike1.speedUp(10);
    bike1.changeGear(2);
    bike1.printStates();


    bike2.changeCadence(50);
    bike2.speedUp(10);
    bike2.changeGear(2);
    bike2.changeCadence(40);
    bike2.speedUp(10);
    bike2.changeGear(3);
    bike2.printStates();
    }
    }

    Learn More
  3. PRG 421 Week 2 Individual Analyze Assignment Demonstrate the Coding to Produce Output to a File

    PRG 421 Week 2 Individual Analyze Assignment Demonstrate the Coding to Produce Output to a File

    Regular Price: $6.00

    Special Price: $4.00

    PRG 421 Week 2 Individual Analyze Assignment Demonstrate the Coding to Produce Output to a File


    "Demonstrate the Coding to Produce Output to a File" text file
    For this assignment, you will analyze Java™ that presents instructional text on the console, accepts user input, and then creates a file based on that user input.
    Read the linked Java™ code carefully.
    Then, answer the following questions in a Microsoft® Word file:
    As you run the program in NetBeans the first time, at the prompt (the program will pause for input) type abc Return def Return ghi Ctrl+Shift+Del. What is the result?
    As you run the program in NetBeans the second time, at the prompt (the program will pause for input) type 123 Ctrl+Shift +Del. What is the result?
    What happens if the file Data.txt already exists when you run the program?
    What happens if the file Data.txt does not already exist when you run the program?


    Submit your Word file to the Assignment Files tab.


    /**********************************************************************
    *   Program:   FileOut 
    *    Purpose:    Demonstrate the coding to produce output to a file.  
    *   Programmer:   I am student         
    *   Class:       PRG/421r13, Java Programming II         
    *   Instructor:             
    *   Creation Date:   01/03/2018 
    *
    ***********************************************************************/
    package fileout;
    import java.io.*;


    public class FileOut {
    public static void main(String[] args) {


    InputStream istream;
    OutputStream ostream=null;
       // FileOutputStream creates an OutputStream that you can use to write bytes to a file.
    int c;                     // character stream 
    final int EOF = -1;                 // EOF indicator
    istream = System.in;


     
    // If the Data.txt file already exists, present its contents on the console.
    String fileName = "Data.txt";         // name of the file to open.
    String line = null;               // will reference one line at a time


    try {
    FileReader fileReader =        // FileReader reads text file
    new FileReader(fileName);         // reads in data from the file


    // always wrap FileReader in BufferedReader (to verify)
    BufferedReader bufferedReader =
    new BufferedReader(fileReader);


    System.out.println("Here are the contents of the current file named " + fileName + ":\n");
    while((line = bufferedReader.readLine()) != null) {
    System.out.println(line);        // verify / display what is read in by the program
    }  
    bufferedReader.close();         // close file


    }
    catch(FileNotFoundException ex) {       // coding to verify file can be opened
    System.out.println(           // if not open, error message to display
    "Unable to open file '" +
    fileName + "'");
    }
    catch(IOException ex) {           // exception, when there is an error in reading
    System.out.println(
    "Error reading file '"
    + fileName + "'");
    }


    // Now, let's construct a new file containing user input.
    System.out.println("\nType characters to write to file. After you finish, press Ctrl+Shift+Del to end.");
    File outFile = new File("Data.txt");    // create a new file


    try {                     // try block for EOF indicator
    ostream = new FileOutputStream(outFile);
    while ((c = istream.read()) != EOF)     // look for end of file in istream
    ostream.write(c);
    } catch (IOException e) {
    System.out.println("Error: " + e.getMessage());
    } finally {
    try {                     // try block for file error ñ file did not close


    istream.close();             // close input and output
    ostream.close();
    } catch (IOException e) {
    System.out.println("File did not close");
    }
    }
    }
    }

    Learn More
  4. ITSD322 Unit 3 Java AnimalInfo console program

    ITSD322 Unit 3 Java AnimalInfo console program

    Regular Price: $20.00

    Special Price: $15.00

    ITSD322 Unit 3 Java AnimalInfo console program


    So far, you have learned about design and how to create a simple Java application using an IDE. Now, you are going to gain some experience writing an object-oriented program with classes, objects, inheritance, and polymorphism. These terms sound complex, but you will find they are not difficult to use. You will be drawing on all the information you have gained, and this project will require some time, so start early, and pay attention to instructions.


    For this project, you will write a Java program that allows the user to select an animal from a menu and then display information about the animal.
    Create a new project in your IDE named "AnimalInfo."
    Create a class called "AnimalInfo" as the main class for the program.
    Create a class called "Animal" with a virtual method displayInfo().
    Create 3 classes inherited from Animal (one for each of your animals). Each of the inherited classes should override Animal.displayInfo() to display information about the animal. The information should just be a short description of the animal displayed to the screen.
    In the AnimalInfo.main) method, display a menu allowing the user to choose 1 of 3 animals or quit the program. The menu should accept input from the user and take the appropriate action and then repeat until the user selects the option to quit. Hint: Simple menus are easiest to implement if the user selects a letter or number for each menu item.
    When the user selects an animal, use the displayInfo() method of the appropriate class to display information about the selected animal.
    Use comments throughout your code demonstrating your understanding of each statement of code.
    Make sure the program runs correctly before submission.
    Create a zip that includes your project folder and Word document, and upload it to the course portal.

    Learn More
  5. ITSD322 Unit 2 Java console program

    ITSD322 Unit 2 Java console program

    Regular Price: $20.00

    Special Price: $15.00

    ITSD322 Unit 2 Java console program


    The first step in writing a software application is to determine the requirements. There is no value in writing a program that does not address the needs of the client. Requirements can be gathered in many ways, but ultimately, the requirements serve to document what the application should and should not do. After the requirements are written, the application design can be prepared, followed by the actual coding. For this project, you will gain some practice in the design phase of software development by designing a program that will meet a given set of requirements.
    Develop a console program that simulates a section of a restaurant menu. Each item will have a different price and your program should define at least ten (10) items. You will need to obtain an order from the user who should provide their menu selection along with quantity. The total cost for the meal must be calculated. The user will enter the amount of their payment ($10, $20, etc.). The program needs to calculate the amount due back to the user (payment minus total cost of meal).
    The project instructions and deliverables are as follows:
    Create a document in Word (name the design document yourName_Unit2.IP), and add the following:
    Title page
    Course number and name
    Project name
    Student name
    Date
    List the data items that must be stored and used by the program. Each data item should be given a name for reference. Develop a UML class diagram that illustrates the data items for your program.
    List the decisions the program must make. References to the data items in the previous step should be used where appropriate.
    Describe the flow of operation of the program by preparing pseudocode or a UML activity diagram. All key activities should be included, and references to the data items and decisions listed in the previous steps should be used.
    Create a zip that includes your project folder and Word document, and upload it to the course portal.

    Learn More
  6. ITSD322 Unit 1 Java console program

    ITSD322 Unit 1 Java console program

    Regular Price: $15.00

    Special Price: $12.00

    ITSD322 Unit 1 Java console program


    Throughout this course, you will be learning about object-oriented programming and demonstrating what you learn by writing some programs in Java. The first step will be to install and integrated development environment (IDE) that will be where you will write and compile your programs. You will also write your first program using Java to show that you have correctly installed the IDE.
    The project instructions and deliverables are as follows:
    Download and install Java JDK and NetBeans IDE using the default installation options.
    Run the IDE, and take a screenshot.
    Create a console program that prompts the user to enter the name and address of their employer and position they hold or the name and address of their favorite restaurant and their favorite meal.
    Display this information on the screen, each on a separate line.
    Run your modified program and take a screenshot of the results.
    Create a document in Word, and add the following:
    Title page which includes: CourseNumber, CourseSection, CourseName, ProjectName (Unit 1 IP), StudentName and Date.
    Screen shots showing the IDE running.
    Screen shot showing the program's output.
    Create a zip that includes your project folder and Word document, and upload it to the course portal.

    Learn More
  7. Introduction To Java 9th Edition Chapter 22 Exercise 13 The 24-point game Success

    Introduction To Java 9th Edition Chapter 22 Exercise 13 The 24-point game

    Regular Price: $25.00

    Special Price: $20.00

    Introduction To Java 9th Edition Chapter 22 Exercise 13 The 24-point game


    (Game: the 24-point card game) The 24-point game is to pick any 4 cards from 52 cards, as shown in Figure 22.19. Note that the Jokers are excluded. Each card represents a number. An Ace, King, Queen, and Jack represent 1, 13, 12, and 11, respectively. You can click the Refresh button to get four cards. Enter an expression that uses the four numbers from the four selected cards. Each number must be used once and only once. You can use the operators (addition, subtraction, multiplication, and division) and parentheses in the expression. The expression must evaluate to 24. After entering the expression, click the Verify button to check whether the numbers in the expression are currently selected and whether the result of the expression is correct. Display the verification in a dialog box. Assume that images are stored in files named 1.png, 2.png, . . . , 52.png, in the order of spades, hearts, diamonds, and clubs. So, the first 13 images are for spades 1, 2, 3, . . . , and 13.

    Learn More
  8. Introduction To Java 9th Edition Chapter 25 Exercise 17 Radix sort animation

    Introduction To Java 9th Edition Chapter 25 Exercise 17 Radix sort animation

    Regular Price: $25.00

    Special Price: $20.00

    Introduction To Java 9th Edition Chapter 25 Exercise 17 Radix sort animation

    Write a Java applet that animates the radix sort algorithm. Create an array that consists of 20 random numbers from 0 to 1,000. The array elements are displayed, as shown in Figure 25.19. Clicking the Step button causes the program to place a number in a bucket. The number that has just been placed is displayed in red. Once all the numbers are placed in the buckets, clicking the Step button collects all the numbers from the buckets and moves them back to the array. When the algorithm is finished, clicking the Step button displays a dialog box to inform the user. Clicking the Reset button creates a new random array for a new start.

    Learn More
  9. CIS355A Week 6 iLab 6 Java Pizza Swing

    CIS355A Week 6 iLab Swing and Database Connection

    Regular Price: $25.00

    Special Price: $20.00

    CIS355A Week 6 iLab Swing and Database Connection

    iLAB OVERVIEW
    Scenario/Summary
    Develop one application using JTabbedPanes and JFrames and another application that connects to a MySQL database.
    Deliverables
    1. JavaPizza
    2. ContactList

    iLAB STEPS
    Step 1: JavaPizza
    Develop an application using a JTabbedPane to order a pizza. You will need to ask the customer for their name and phone number. You will ask for the size (choose one) and toppings (choose many) and compute the total. After computing the total, provide a button to display the order summary, which includes the name, phone number, size, toppings, and total. The prices are listed below. Screenshots of a possible solution are included. Your application must include four tabs and open a new window when the button is clicked.
    • Small:  8.00
    • Medium: 10.00
    • Large: 12.00
    Each topping is 2.00 extra.
     
    JavaPizza    Points    Description
    Standard header included    1    Must contain program's name, student name, and description of the program
    Program compiles    1    Program does not have any error
    Program executes    1    Program runs without any error
    Created the JTabbedPane with four tabs    4    The JTabbedPane is displayed with the four required tabs and components on each tab
    Total is calculated correctly    5    The total on the last tab is calculated correctly based on information supplied.
    Order summary window displayed correctly    8    The order summary window is displayed with a JTextArea, including all information from the four tabs.
    Subtotal    20      
     
    Step 2: Contact List
    Develop a Java application to add a contact into the contact table, and display all contacts in the contact table. The contact table contains two columns, FullName, and PhoneNumber. Both values are text data. Use JOptionPanes to ask for the contact data, and display a confirmation message when the contact is added. Display the list of contacts in the console. Screenshots of a possible solution are included.
     
    ContactList    Points    Description
    Standard header included    1    Must contain program's name, student name, and description of the program
    Program compiles    1    Program does not have any error
    Program executes    1    Program runs without any error
    Created the JOptionPanes for input    6    Two JOptionPanes are displayed to retrieve input
    JOptionPane displayed upon insert    4    A JOptionPane is display to confirm the contact was added
    ContactList shown in console    7    The list of contacts is displayed in the console under a heading contact list .
    Subtotal    20

    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 41 to 50 of 109 total

per page
Page:
  1. 3
  2. 4
  3. 5
  4. 6
  5. 7

Grid  List 

Set Ascending Direction