Questions
NEED DONE IN AN HOUR File 1 - HotTubLastname.java Write a class that will hold fields...

NEED DONE IN AN HOUR

File 1 - HotTubLastname.java

  • Write a class that will hold fields for the following:
    • The model of the hot tub
    • The hot tub’s feature package (can be Basic or Premium)
    • The hot tub’s length (in inches)
    • The hot tub’s width (in inches)
    • The hot tub’s depth (in inches)
  • The class should also contain the following methods:
    • A constructor that doesn’t accept arguments
    • A constructor that accepts arguments for each field.
    • Appropriate accessor and mutator methods (i.e., setters and getters).
    • A method named getCapacity that accepts no arguments and calculates and returns the capacity (in gallons) of the hot tub.

The capacity of the hot tub can be calculated by using the following formula:

Capacity in gallons = (Length * Width * Depth) / 1728 * 4.8

    • A method named getPrice that accepts no arguments and calculates and returns the price of the hot tub based on the following table:

Hot Tub Capacity

Package

Cost Per Gallon

Less than 350 gallons

Basic

$5.00

Less than 350 gallons

Premium

$6.50

350 but not more than 500 gallons

Basic

$6.00

350 but not more than 500 gallons

Premium

$8.00

Over 500 gallons

Basic

$7.50

Over 500 gallons

Premium

$10.00


Price = Cost Per Gallon * Capacity

File 2 - DemoLastname.java

  • Write a program that demonstrates the class and calculates the cost of hot tubs. The program should ask the user for the following:
    • The model of the hot tub
    • The hot tub’s feature package (can be Basic or Premium)
    • The hot tub’s length (in inches). The program should not accept a number less than 60 for the length.
    • The hot tub’s width (in inches). The program should not accept a number less than 60 for the width.
    • The hot tub’s depth (in inches). The program should not accept a number less than 30 for the depth.
  • The program should prompt the user for all the data necessary to fully initialize the objects. IMPORTANT: Store your objects in a container that will automatically expand as objects are added.
  • The program should continue allowing the user to input information until the user indicates to stop (see sample input on page 3). Note: The program should accept lower or upper case responses to this question.
  • After the user indicates that they wish to stop, the program should output the information for each hot tub.
    • The capacity of the hot tub should be formatted to two decimal places.
    • The price of the hot tub should be formatted as currency to two decimal places and include a comma in the thousands place.
  • After the program outputs the information for each hot tub, it should output the total cost of all of the hot tubs.
  • The program should display the input and output as shown in the provided sample output (Note: this includes blank lines).

In: Computer Science

How will you, as the project manager, know whether the project is following the desired path...

How will you, as the project manager, know whether the project is following the desired path as per the project measurement plan? Please provide a detailed answer.

In: Computer Science

***JAVA PROGRAM Write a method called shrink that accepts an array of integers (that the user...

***JAVA PROGRAM

Write a method called shrink that accepts an array of integers (that the user inputs) as a parameter and returns a new array containing the result of replacing each pair of integers with the sum of that pair. For example, if an array called list stores the values {7, 2, 8, 9, 4, 15, 7, 1, 9, 10}, then the call of shrink(list) should return a new array containing {9, 17, 19, 8, 19}.

The first pair from the original list is shrunken into 9 (7 + 2),

the second pair is shrunken into 17 (8 + 9), and so on.

If the list stores an odd number of elements, the final element is not collapsed. For example, if the list had been {1, 2, 3, 4, 5}, then the call would return {3, 7, 5}. Your method should not change the array that is passed as a parameter.

Be sure to have a shrink() method

*All variable names are completely up to you, as long as they’re descriptive

*Use the correct data types

*Use comments to explain what you’re coding

*Put your name in a comment

In: Computer Science

1) How do you extract a part of a string? Give the command and examples (in...

1) How do you extract a part of a string? Give the command and examples (in arduino)

2) Explain how negation and comparison operators combine together. (in Arduino)

3) What are the qualifiers? (in Arduino)

4) List the increment and decrement operators. (in Arduino)

In: Computer Science

Flow this Code to answer question below #include <iostream> using std::cout; struct Node {     int...

Flow this Code to answer question below

#include <iostream>

using std::cout;

struct Node {

    int data;

    Node *link;

                 Node(int data=0, Node *p = nullptr) { //Note, this constructor combines both default and parameterized constructors. You may modify the contructor to your needs

        this->data = data;

                                  link = p;

    }

};

class linked_list

{

private:

    Node *head,*current;

public:

     //constructor

    linked_list() {

        head = nullptr;//the head pointer

        current = nullptr;//acts as the tail of the list

    }

    //destructor - IMPORTANT

    ~linked_list() {

                                  current = head;

                                  while( current != nullptr ) {//the loop stops when both current and head are NULL

                                  head = head->link;

                                  delete current;

                                  current = head;

                                  }

    }

    void addLast(int n) {// to add a node at the end of the list

        if(head == nullptr){

            head = new Node(n);

            current = head;

        } else {

                                                   if( current->link != nullptr)

                                                                    current = current->link;

            current->link = new Node(n);

            current = current->link;//You may decide whether to keep this line or not for the function

        }

    }

   

    void print() { // to display all nodes in the list

        Node *tmp = head;

        while (tmp != nullptr) {

            cout << tmp->data << std::endl;

            tmp = tmp->link;

        }

    }

};

int main() {

    linked_list a;

    a.addLast(1);

   a.addLast(2);

                 a.print();

   

    return 0;

}

Question:

Create the node structure and the linked list class. The sample class has implemented the following member methods:

o constructor

o destructor

o print(),

o addLast()

2. Implement the following member methods:

▪ addFirst (T data) // Adds a node with data at the beginning of the list

▪ pop() // Removes the first node of the list. Note: Don't forget to delete/reallocate the removed dynamic memory

▪ contains(T data) // Returns true or false if a node contains the data exists in the list

▪ update(T oldDate, T newData) // Updates the oldData of a node in the list with newData.

▪ size() // Returns the number of nodes in the list

▪ remove( T data) //Removes the node that contains the data. Note, you will need to check if the node exists. Again, don't forget to delete/re-allocate the dynamic memory

3. (Extra Credit Part) Implement the following additional member methods

▪ insertAfter(int n, T data) //Adds a node after the n-th node. Note, you will need to check if the n th node exists, if not, do addLast().

▪ merge(const LinkedList &linkedlist) //Merges this object with linkedlist object. In other words, add all nodes in linkedlist to this object.

In: Computer Science

create a program that asks the user’s height What is your height? Use the input function...

create a program that asks the user’s height

  1. What is your height? Use the input function to ask this question
  2. If the answer to question 1 is greater than or equal to five, print "Yay! You can get on the rides alone"
  3. If the answer to question 1 is less than five and greater than four, print "You must be accompanied by an adult"
  4. Otherwise, print "Sorry you’re not allowed on the rides"

In: Computer Science

For this task you will create a Point3D class to represent a point that has coordinates...

For this task you will create a Point3D class to represent a point that has coordinates in three dimensions labeled x, y and z. You will then use the class to perform some calculations on an array of these points. You need to draw a UML diagram for the class (Point3D) and then implement the class.
The Point3D class will have the following state and functionality:

  • Three data fields, x, y and z, of type double, represent the point’s coordinates
  • Additional data field, colour, of type String, represents the point's color
  • A no-arg constructor creates a point at position (0, 0, 0) and "Red" colour.
  • Another constructor creates a point with specified coordinates and colour.
  • A getter method is provided for each of the fields.
  • An accessor method named distance returns the distance between the current point and another point passed as an argument.
  • The distance method is overloaded to accept the coordinates of the other point.

Write a TestPoint3D class that will have a main method, and perhaps other methods as required by good design, to test your Point3D class. It will not have user input because this class will stand as a record of the tests you have applied and you will be able to run it whenever you alter your Point3D class. For the TestPoint3D class you will need to do the following:

  • Test the basic state and functionality of the Point3D class. Each of the constructors and each of the methods should be tested using some different data values. The test code should display values so that they can be checked.
  • Write some code to create an array of at least 10 Point3D objects.
  • Write a method max, which will accept the array of points as an argument, and will calculate and display the maximum distance between the points in the array, and the pair of points for which the maximum occurs.
  • Write a method min, which will accept the array of points as an argument, and will calculate and display the minimum distance between the points in the array, and the pair of points for which the minimum occurs.

In: Computer Science

Shapes2D Write the following four classes to practice using an abstract class and polymorphism. Submit all...

Shapes2D
Write the following four classes to practice using an abstract class and polymorphism. Submit all four classes.

Shape2D class
For this class, include just an abstract method name get2DArea() that returns a double.

Rectangle2D class
Make this class inherit from the Shape2D class. Have it store a length and a width as fields. Provide a constructor that takes two double arguments and uses them to set the fields. Note, the area of a rectangle is the length times the width.

Circle2D class
Also make this class inherit from the Shape2D class. Have it store a radius as a field. Provide a constructor that takes a double argument and uses it to set the field. Note, the area of a circle is PI times it's radius times it's radius.

Shape2DDriver class
Have this class provide a method named displayName() that takes an object from just any of the above three classes (you can't use an Object type parameter). Have the method display the area of the object, rounded to one decimal place.

In: Computer Science

PART A Write a C program that takes the names and surnames of the students and...

PART A

Write a C program that takes the names and surnames of the students and then displays the initial and last name of the name on the screen. For instance, if Onur Uslu is entered as input, the output of our program must be O. Uslu.

PART B

Write a C program that asks the user to enter a string and then sends it to a function that does the following job and shows the response from the function on the screen. The function must return all words in the string from the program by converting the initial letters into their large form.

Example Output

Type of a string:Hello world

New sentence:Hello World

In: Computer Science

Think of an algorithm to find the maximum value in an (unsorted) array. Now, think of...

Think of an algorithm to find the maximum value in an (unsorted) array. Now, think of an algorithm to find the second largest value in the array. Which is harder to implement? Which takes more time to run (as measured by the number of comparisons performed)? Now, think of an algorithm to find the third largest value. Finally, think of an algorithm to find the middle value. Which is the most difficult of these problems to solve?

In: Computer Science

Objective: Design and test a 4-bit Right shift register with serial input. Part I Use D...

Objective: Design and test a 4-bit Right shift register with serial input.

Part I

Use D flip-flops (FF) in your design (Memory → D Flip-Flop). Ensure the output of each FF (Q) goes to an output so the functionally of the shift register can be verified. All 4 Flip-Flop need to share a common clock which is connected to an input you can control. Verify the functionally of the circuit by changing the input value and toggling the clock. You should see the value in the register shift to the right.

Part II

Modify the circuit so that if the register contains 1010 OR 0111 an output signal goes active (logic 1). Verify the functionally of the circuit by shifting in the two values to be detected and ensure the output goes high (logic 1).

Please use some kind of software and attach screenshots

In: Computer Science

Briefly describe what each of the following statements does. file.seekp(100L, ios::beg); file.seekp(-10L, ios::end); file.seekg(-25L, ios::cur); file.seekg(30L,...

  1. Briefly describe what each of the following statements does.

file.seekp(100L, ios::beg);

file.seekp(-10L, ios::end);

file.seekg(-25L, ios::cur);

file.seekg(30L, ios::cur);

  1. Describe the mode that each of the following statements causes a file to be opened in.

file.open("info.dat", ios::in | ios::out);

file.open("info.dat", ios::in | ios::app);

file.open("info.dat", ios::in | ios::out | ios::ate);

file.open("info.dat", ios::in | ios::out | ios::binary);

In: Computer Science

Shapes2D Write the following four classes to practice using an abstract class and polymorphism. Submit all...

Shapes2D
Write the following four classes to practice using an abstract class and polymorphism. Submit all four classes.

Shape2D class
For this class, include just an abstract method name get2DArea() that returns a double.

Rectangle2D class
Make this class inherit from the Shape2D class. Have it store a length and a width as fields. Provide a constructor that takes two double arguments and uses them to set the fields. Note, the area of a rectangle is the length times the width.

Circle2D class
Also make this class inherit from the Shape2D class. Have it store a radius as a field. Provide a constructor that takes a double argument and uses it to set the field. Note, the area of a circle is PI times it's radius times it's radius.

Shape2DDriver class
Have this class provide a method named displayName() that takes an object from just any of the above three classes (you can't use an Object type parameter). Have the method display the area of the object, rounded to one decimal place.

Written in java

In: Computer Science

only the Java programInstructions: This project has three parts. Remember to make a copy of this...

only the Java programInstructions:

This project has three parts. Remember to make a copy of this project so you can refer to it when completing the other phases.

Review the sample program before starting this project. The sample program does not exactly match the requirements for this project, so some critical thinking will still be required; however, it is a good thing to reference before starting the project.

Project 2 is a continuation of Project 1. Modify the code from Project 1 in the following ways:

Step 1: Add code to prompt the user to enter the name of the room that they are entering information for.

Step 2: Add Input Validation to the code using the following rules:

  • The length of the room cannot be less than 5 feet
  • The width of the room cannot be less than 5 feet
  • The user's menu selection for the amount of shade should be 1, 2, or 3.

If the user's input is invalid, the program should display an appropriate error message and prompt the user to re-enter their input. The user should be given an unlimited amount of attempts to enter valid input

Step 3: Add code to have the program ask the user if they would like to enter information about another room after the information for a previous room has been processed and displayed. The user should be able to enter a "y" or "Y" to indicate that they want to enter information about another room. See the Sample Input and Output for how to format this.

Step 4: After the user has indicated that they do not wish to enter information about another room, the program should output the number of rooms that have been entered and then stop executing.

Sample Input and Output (user input is in bold) - The output of your program should match the formatting and spacing exactly as shown

Please enter the name of the room: Guest Bedroom
Please enter the length of the room (in feet): 15.5
Please enter the width of the room (in feet): 10
What is the amount of shade that this room receives?

  1. Little Shade
  2. Moderate Shade
  3. Abundant Shade

Please select from the options above: 3

Air Conditioning Window Unit Cooling Capacity

Room Name: Guest Bedroom
Room Area (in square feet): 155.0
Amount of Shade: Abundant
BTUs Per Hour needed: 4,950

Would you like to enter information for another room (Y/N)? Y

Please enter the name of the room: Kitchen
Please enter the length of the room (in feet): 20
Please enter the width of the room (in feet): 15
What is the amount of shade that this room receives?

  1. Little Shade
  2. Moderate Shade
  3. Abundant Shade

Please select from the options above: 2

Air Conditioning Window Unit Cooling Capacity

Room Name: Kitchen
Room Area (in square feet): 300.0
Amount of Shade: Moderate
BTUs Per Hour needed: 10,000

Would you like to enter information for another room (Y/N)? N

The total number of rooms processed was: 2

In: Computer Science

Write a c++ program that asks the user to choose his preferred shape, and asks then...

Write a c++ program that asks the user to choose his preferred shape, and asks then for two numbers (positive but not necessary integers) in order to calculate the shape's area.

The possible shapes are: Triangle, Ring and Rectangle. If the user chose a different shape, you

will warn him and wait for a valid shape.

  • The area of a circle is πr12-r22 (suppose π= 3.4 ).
  • The area of a triangle is base*height/2.
  • The area of a rectangle is height*width.

While the user will enter the values in cm , the program will display the number of paint bottles

needed to paint the area of the shape. Each bottle can cover 5cm^2. The number of paint bottles should be an integer value.

In: Computer Science