Questions
This exercise requires designing a program which solves the problem described in the problem statement below....

This exercise requires designing a program which solves the problem described in the problem statement below. Provide comments in your pseudo-code and Java program as necessary.

Your solution must include these components:

  1. UML Class diagram
  2. Flowchart
  3. Pseudo-code
  4. Program Coded
  5. Program Output

Problem Statement

Design a class named Pet, which should have the following fields:

  • name: The name field holds the name of a pet.

  • type: The type field hold the type of animal that a pet is (for example, “dog”, “cat”, “bird”)

  • age: The age field holds the pet’s age.

The Pet class should also have the following methods:

  • setName: the setName method stores a value in the name field.

  • setType: the setType method stores a value in the type field

  • setAge: the setAge method stores a value in the age field.

  • getName: the getName method returns the value of the name field.

  • getType: The getType method returns the value of the type field.

  • getAge: the getAge method returns the value of the age field.

Once you have designed the class, design a program that creates an object of the class and prompts the user to enter the name, type, and age of his or her pet. This data should be stored in the object. Use the object’s accessor methods to retrieve the pet’s name, type, and age and display this data on the screen.

Expected Output

Your results should be similar to the following:

Please enter the name of your pet: Maestro

Please enter the type of your pet: dog

Please enter the age of your pet: 8


The name of your pet is Maestro.

Maestro is a dog.

Maestro is 8 years old.

Submission

Submit your assignment as a Microsoft Word document (.docx) with all components in the one document. Once submitted, the answer will be revealed.

Grading

This practice problem is NOT graded. However, you must complete the practice problem and survey before your graded programming assignment problem will be revealed.

In: Computer Science

Run the program and enter domain names to validate. Note that even valid input is flagged...

  1. Run the program and enter domain names to validate. Note that even valid input is flagged as invalid.
  2. Change the program to validate a domain name. A valid domain name for this program has a second-level domain followed by a core gTLD. Run the program again.

    import java.util.Scanner;

    public class CoreGtldValidation {   
    public static void main (String [ ] args) {
    Scanner scnr = new Scanner(System.in);
    String coreGtld1;
    String coreGtld2;
    String coreGtld3;
    String coreGtld4;
    String inputName;
    String searchName;
    String theTld;
    boolean isCoreGtld;
    // FIXME: Add variable periodCounter to count periods in a domain name
    int periodPosition; // Position of the period in the domain name
    int i;

    coreGtld1 = ".com";
    coreGtld2 = ".net";
    coreGtld3 = ".org";
    coreGtld4 = ".info";
    theTld = "";
    isCoreGtld = false;
    periodPosition = 0;

    System.out.println("\nEnter the next domain name (<Enter> to exit): ");
    inputName = scnr.nextLine();

    while (inputName.length() > 0) {
    searchName = inputName.toLowerCase();
    isCoreGtld = false;

    // FIXME: Write a for loop using variable i to store in periodCounter
    // the number of periods in searchName. Store the position of the
    // period in periodPosition. If searchName has exactly one period
    // and searchName's first character is not a period, determine
    // whether searchName has a valid core gTLD by extracting the
    // domain name into variable coreGtld and comparing the name with
    // valid core gTLDs.

    // Extract the top-level domain name starting at the period's position.
    // Ex: If searchName = "example.com", the next statement extracts ".com"
    theTld = searchName.substring(periodPosition);

    if (theTld.equals(coreGtld1)) {
    isCoreGtld = true;
    }
    else if (theTld.equals(coreGtld2)) {
    isCoreGtld = true;
    }
    else if (theTld.equals(coreGtld3)) {
    isCoreGtld = true;
    }
    else if (theTld.equals(coreGtld4)) {
    isCoreGtld = true;
    }
    else {
    isCoreGtld = false;
    }

    System.out.print("\"" + inputName + "\" ");
    if (isCoreGtld) {
    System.out.println(" is a second-level domain followed by a core gTLD of \"" +
    theTld + "\"");
    }
    else {
    System.out.println("is not a second-level domain followed by a core gTLD.");
    }

    System.out.println("\nEnter the next domain name (or <Enter> to exit): ");
    inputName = scnr.nextLine();
    }
    }
    }

In: Computer Science

/* Problem 1 * Write and run a java program that prints out two things you...

/*      Problem 1
*       Write and run a java program that prints out two things you have learned
*   so far in this class, and three things you hope to learn, all in different lines. 
*/

You could write any two basic  things in Java.
/*      Problem 2
*       The formula for finding the area of a triangle is 1/2 (Base * height). 
*       The formula for finding the perimeter of a rectangle is 2(length * width). 
*   Write a program that prompts the user to enter the base and height of a triangle. 
*       The program then calculates the area of the triangle.
*       The program also prompts the user to enter the length and width of a rectangle.
*   The program then calculates the perimeter of the rectangle. 
*       Your code must print out: the base of the triangle, the width of the triangle, the area
*       of the triangle, the length of the rectangle, the width of the rectangle, and the area of the rectangle.
*       (5 Points.)
*/

/*      Problem 3
*       Write and run a java program that prompts you to enter your year of birth. 
*       The program then returns your age by subtracting your year of birth from the
*   current year. The program must print: You are x years old, where x is your 
*       age. You must import the scanner class (5 Points.)

/*      Problem 4
*       Write a java program that asks the user to enter her\his first name,
*       middle initial, last name, class name, letter grade, and GPA.
*       The program then prints out the above items as follows.
*       Line 1: Your name is first name, middle initial, last name.
*       Line 2: You are enrolled in class name
*       Line 3: You scored letter grade ... in class name
*       Line 4: Your GPA in class name is GPA

*       Hint: To read characters from the scanner, you should use this syntax:
*       String firstName = input.nextLine();

*       Note that you will use both String and double variable types.

* Note that we use Notepad ++ in our class for java and we also use cmd

In: Computer Science

6.23 LAB: Python insert/update sqlite3 datafiles Given is a Python program that connects to a sqlite...

6.23 LAB: Python insert/update sqlite3 datafiles

Given is a Python program that connects to a sqlite database and has one table called writers with two columnns:

  • name - the name of a writer
  • num - the number of works the writer has written

The writers table originally has the following data:

name, num
Jane Austen,6
Charles Dickens,20
Ernest Hemingway,9
Jack Kerouac,22
F. Scott Fitzgerald,8
Mary Shelley,7
Charlotte Bronte,5
Mark Twain,11
Agatha Christie,73
Ian Flemming,14
J.K. Rowling,14
Stephen King,54
Oscar Wilde,1

Update the Python program to ask the user if they want to update entries or add new entries. If the name entered already exists in the writers table then the database record is updated, overwriting the original contents. If the name does not exist in the writers table, then add a new record with the writer's name and number of works. The following TODO sections must be completed.

  • Check if a writer exists in the writers table
  • If the writer exists in the table, locate an entry to be updated by writer's name and update the writer's value for num
  • If the writer does not exist in the table, add a new entry in the writers table and provide the value for name and num

Ex: If the input is:

y
J.K. Rowling
30
y
Elton John
y
62
n

The output is:

(ID, Name, Num)
(1, 'Jane Austen', 6)
(2, 'Charles Dickens', 20)
(3, 'Ernest Hemingway', 9)
(4, 'Jack Kerouac', 22)
(5, 'F. Scott Fitzgerald', 8)
(6, 'Mary Shelley', 7)
(7, 'Charlotte Bronte', 5)
(8, 'Mark Twain', 11)
(9, 'Agatha Christie', 73)
(10, 'Ian Flemming', 14)
(11, 'J.K. Rowling', 30)
(12, 'Stephen King', 54)
(13, 'Oscar Wilde', 1)
(14, 'Elton John', 62)

In: Computer Science

6.23 LAB: Python insert/update sqlite3 datafiles Given is a Python program that connects to a sqlite...

6.23 LAB: Python insert/update sqlite3 datafiles

Given is a Python program that connects to a sqlite database and has one table called writers with two columnns:

  • name - the name of a writer
  • num - the number of works the writer has written

The writers table originally has the following data:

name, num
Jane Austen,6
Charles Dickens,20
Ernest Hemingway,9
Jack Kerouac,22
F. Scott Fitzgerald,8
Mary Shelley,7
Charlotte Bronte,5
Mark Twain,11
Agatha Christie,73
Ian Flemming,14
J.K. Rowling,14
Stephen King,54
Oscar Wilde,1

Update the Python program to ask the user if they want to update entries or add new entries. If the name entered already exists in the writers table then the database record is updated, overwriting the original contents. If the name does not exist in the writers table, then add a new record with the writer's name and number of works. The following TODO sections must be completed.

  • Check if a writer exists in the writers table
  • If the writer exists in the table, locate an entry to be updated by writer's name and update the writer's value for num
  • If the writer does not exist in the table, add a new entry in the writers table and provide the value for name and num

Ex: If the input is:

y
J.K. Rowling
30
y
Elton John
y
62
n

The output is:

(ID, Name, Num)
(1, 'Jane Austen', 6)
(2, 'Charles Dickens', 20)
(3, 'Ernest Hemingway', 9)
(4, 'Jack Kerouac', 22)
(5, 'F. Scott Fitzgerald', 8)
(6, 'Mary Shelley', 7)
(7, 'Charlotte Bronte', 5)
(8, 'Mark Twain', 11)
(9, 'Agatha Christie', 73)
(10, 'Ian Flemming', 14)
(11, 'J.K. Rowling', 30)
(12, 'Stephen King', 54)
(13, 'Oscar Wilde', 1)
(14, 'Elton John', 62)

In: Computer Science

Operating data for Navarro Corporation are presented below.

Operating data for Navarro Corporation are presented below.

2017 2016 Net sales $750,000 $600,000 Cost of goods sold Selling expenses Administrative expenses Income tax expense 465,000 105,000 60,000 36,000 390,000 66,000 54,000 27,000 63,000 Net income 84,000

 

Instructions

Prepare a schedule showing a vertical analysis for 2017 and 2016.

In: Finance

According to the 2016 COSO Fraud Risk Management Guide, what methods can an organization employ to...

According to the 2016 COSO Fraud Risk Management Guide, what methods can an organization employ to detect fraud?

In: Accounting

Based on the latest Companies Act 2016, discuss the difficulties in the process of monitoring directors...

Based on the latest Companies Act 2016, discuss the difficulties in the process of monitoring directors in discharging their duties. Illustrate with examples.

In: Accounting

What was the process by which ASU 2016-1 proposed changes were shared with the business, accounting,...

What was the process by which ASU 2016-1 proposed changes were shared with the business, accounting, and investment communities?

In: Accounting

According to projections for 2016 by the Tax Policy Center, the 20 percent of U.S. taxpayers...

According to projections for 2016 by the Tax Policy Center, the 20 percent of U.S. taxpayers who make the highest incomes

In: Economics