Questions
What are the advantages and disadvantages of the list box? when should a list box be...

What are the advantages and disadvantages of the list box? when should a list box be used? Describe some guidelines for when to use a list box.

In: Computer Science

Create a nested structure in C (one structure that contains another) and print out all the...

Create a nested structure in C (one structure that contains another) and print out all the fields in both structures. The main structure should have fields for: movie name and the year it was released. The extended structure should include the original structure as well as fields for: Lead actor, genre and runtime.

In: Computer Science

Please drow Flow chart The program you will be writing displays a weekly payroll report. A...

Please drow Flow chart
The program you will be writing displays a weekly payroll report. A loop in the program should ask the user for the employee’s number, employee’s last name, number of hours worked, hourly pay rate, state tax, and federal tax rate. After the data is entered and the user hits the enter key, the program will calculate gross and net pay then displays employee’s payroll information as follows and asks for the next employees’ information. if the user works over 40 hours, add double rate overtime pay for the hours worked more than 40 hours
  

In: Computer Science

Flooring Quote Calculator Create a program that calculates a price quote for installing different types of...

Flooring Quote Calculator

Create a program that calculates a price quote for installing different types of flooring in a house.

Allows the user to enter the homeowner’s information, number of rooms where they want new flooring installed, the area of each room, and the type of flooring for each room. Your program will then calculate and print the installation costs.

Need to use a House class that contains information about the home and home owner. An inner class, Room, will maintain the dimension and flooring options selected. The House object will maintain an array of Room objects.

Room Class (Inner Class in House.java)

must contain only the following:

  • Two fields, all private
    • area - A double that represents the square footage of the room.
    • floorType - A FloorType object that represents the type of flooring chosen for the room.
  • One constructor, public
    • Accepts two arguments, parameters named areaIn (double) and floorTypeIn (FloorType)
    • Assigns the parameter’s values to their respective fields.
  • Two Methods, both public
    • Getters for both fields

House Class (House.java)

This class must contain only the following:

  • Eight fields, all private
  • ownerName - A String for holding the homeowner’s name.
  • phoneNumber - A String for holding the homeowner’s phone number.
  • streetAddress - A String for holding the house’s street address.
  • city - A String for holding the house’s city.
  • state - A String for holding the house’s state.
  • zipCode - A String for holding the house’s zip code.
  • rooms - An array of Room objects.
  • roomIndex - An int that keeps track of what index to place new Room objects in the rooms array.
  • One constructor, public
    • Accepts one argument- numRooms
    • The numRooms argument is used to instantiate the rooms field with an array of the provided length (numRooms).
    • Assigns empty Strings to the other six fields and assigns zero to roomIndex.
  • Fifteen Methods, both public
    • Setters and getters for only the ownerName, phoneNumber, streetAddress, city, state, and zipCode fields (12 methods total, all public)
    • addRoom (public, returns void)
      • Accepts two arguments, parameters named sqft (double) and fType (FloorType object)
        • “sqft” represents the square footage of the room.
        • fType is an enumerator object. The FloorType class that contains the enumerator is provided. It’s in its own class so all classes for the assignment can use it.
      • The method should use the parameters to instantiate a Room object and add it to the next available index in the array (using the roomIndex field).
      • Remember to increment roomIndex after placing the Room object in the array.
    • getInstallationCost(public, returns double, no parameters)
      • This method calculates and returns the total close of installation.
      • The cost is $10.00 per square foot, regardless of flooring type.
      • You’ll need to use the Room objects in the rooms field to complete this.
    • getFlooringCost(public, returns double, no parameters) ▪ This method calculates and returns the total cost of flooring.
      • Carpet is $7.00 per square foot
      • Tile is $5.00 per square foot
      • Hardwood is $6.00 per square foot
      • You’ll need to use the Room objects in the rooms field to complete this.
  • *****************************************CODE BELOW****

package house;

public class House {

   /*
   * Private data field
   */
   private String ownerName;
   private String phoneNumber;
   private String streetAddress;
   private String city;
   private String state;
   private String zipcode;
   private Room[] rooms;
   private int roomIndex;

   // constructor
   public House(int numRooms) {

       rooms = new Room[numRooms];
       this.ownerName = "";
       this.phoneNumber = "";
       this.streetAddress = "";
       this.city = "";
       this.state = "";
       this.zipcode = "";
       this.roomIndex = 0;
   }

   // getter and setter
   public String getOwnerName() {
       return ownerName;
   }

   public void setOwnerName(String ownerName) {
       this.ownerName = ownerName;
   }

   public String getPhoneNumber() {
       return phoneNumber;
   }

   public void setPhoneNumber(String phoneNumber) {
       this.phoneNumber = phoneNumber;
   }

   public String getStreetAddress() {
       return streetAddress;
   }

   public void setStreetAddress(String streetAddress) {
       this.streetAddress = streetAddress;
   }

   public String getCity() {
       return city;
   }

   public void setCity(String city) {
       this.city = city;
   }

   public String getState() {
       return state;
   }

   public void setState(String state) {
       this.state = state;
   }

   public String getZipcode() {
       return zipcode;
   }

   public void setZipcode(String zipcode) {
       this.zipcode = zipcode;
   }

   // add room
   public void addRoom(double sqft, FloorType floorType) {

       rooms[roomIndex] = new Room(sqft, floorType);
       roomIndex++;
   }

   // installation cost
   public double getInstallationCost() {

       double installationCost = 0;

       for (Room room : rooms) {

           installationCost += room.getArea() * 10.00;
       }

       return installationCost;
   }

   // flooring cost
   public double getFlooringCost() {

       double flooringCost = 0;
       for (Room room : rooms) {

           if (room.getFloorType() == FloorType.CARPET) {

               flooringCost += room.getArea() * 7.00;
           } else if (room.getFloorType() == FloorType.TILE) {

               flooringCost += room.getArea() * 5.00;
           } else if (room.getFloorType() == FloorType.HARDWOOD) {

               flooringCost += room.getArea() * 6.00;
           }
       }

       return flooringCost;
   }

   // enum FloorType
   enum FloorType {

       CARPET, TILE, HARDWOOD
   }

   // class Room
   class Room {

       private double area;
       private FloorType floorType;

       public Room(double area, FloorType floorType) {
           super();
           this.area = area;
           this.floorType = floorType;
       }

       public double getArea() {
           return area;
       }

       public FloorType getFloorType() {
           return floorType;
       }

   }

}

In: Computer Science

How does the use of the HTML5 <nav> tag differ from previous versions of HTML when...

  • How does the use of the HTML5 <nav> tag differ from previous versions of HTML when creating navigation?

In: Computer Science

Programming Language : Python Question a)Where and how do you get a program development environment for...

Programming Language : Python

Question

a)Where and how do you get a program development environment for this language?

b) Are there any IDEs that support this language? If yes, where and how do you get it?

In: Computer Science

How do workloads to enterprise solutions enable rapid failover at scale.

How do workloads to enterprise solutions enable rapid failover at scale.

In: Computer Science

Write a C++ program test.cpp. The class should contain a protected int member variable var, which...

Write a C++ program test.cpp. The class should contain a protected int member variable var, which is initialized with an integer value between 1 and 50 in a constructor that takes an integer parameter. The class should contain a public member function called play that should print out a sequence of integers as a result of iteratively applying a math function f to the member variable var. The function f is defined as f(x) = (3x+1)/2 if x is odd and f(x) = x/2 if x is even.

Stop the iteration when the value 1 is reached.

Example: When var is 6, the play function's output sequence should be 6,3,5,8,4,2,1.

In the main function create an object of this class whose member var should be initialized with the first command-line argument to the program (i.e., argv[1]) and then call the play member function to output the corresponding sequence of integers. You can check whether the supplied first command-line argument is an integer between 1 and 50 in the main function.

A sample run should look like this...

$./test 6

6 3 5 8 4 2 1

In: Computer Science

Describe the status of the N, Z, C, and V flags of the CPSR after each...

Describe the status of the N, Z, C, and V flags of the CPSR after each of the following:
(a) ldr r1, =0xffffffff
ldr r2, =0x00000001
add r0, r1, r2
(b) ldr r1, =0xffffffff
ldr r2, =0x00000001
cmn r1, r2
(c) ldr r1, =0xffffffff
ldr r2, =0x00000001
adds r0, r1, r2
(d) ldr r1, =0xffffffff
ldr r2, =0x00000001
addeq r0, r1, r2
(e) ldr r1, =0x7fffffff
ldr r2, =0x7fffffff
adds r0, r1, r2

In: Computer Science

using python One measure of “unsortedness” in a sequence is the number of pairs of entries...

using python

One measure of “unsortedness” in a sequence is the number of pairs of entries that are out of order with respect to each other. For instance, in the letter sequence “DAABEC”, this measure is 5, since D is greater than four letters to its right and E is greater than one letter to its right. This measure is called the number of inversions in the sequence. The sequence “AACEDGG” has only one inversion (E and D)--it is nearly sorted--while the sequence “ZWQM” has 6 inversions. Formally speaking, two elements a[i] and a[j] form an inversion if a[i] > a[j] and i < j.

So in the sequence 2, 4, 1, 3, 5, there are three inversions (2, 1), (4, 1), (4, 3).

You are responsible for cataloguing a sequence of DNA strings (sequences containing only the four letters A, C, G, and T). However, you want to catalog them, not in alphabetical order, but rather in order of ``sortedness'', from ``most sorted'' (lowest inversions) to ``least sorted'’ (highest inversions). All the strings are of the same length.

Input: These are m character sequences given each of fixed length. If the input is “#”, stop the input.

Output: Output the list of input strings, arranged from ``most sorted'' to ``least sorted''. If two or more strings are equally sorted, list them in the same order they are in the input file.

Sample Input: AACATGAAGG TTTTGGCCAA TTTGGCCAAA GATCAGATTT CCCGGGGGGA ATCGATGCAT

Sample Output: CCCGGGGGGA AACATGAAGG GATCAGATTT ATCGATGCAT TTTTGGCCAA TTTGGCCAAA

In: Computer Science

Select one of the following three common computer science problems and describe how recursion can be...

Select one of the following three common computer science problems and describe how recursion can be used to solve this problem more efficiently (sorting, minimum cost spanning tree, knapsack problem). You must generally describe the algorithm that would be used to solve the problem and detail how recursion makes the algorithm more asymptotically efficient.

In: Computer Science

This is for Javascript programming language: A. Class and Constructor Creation Book Class Create a constructor...

This is for Javascript programming language:

A. Class and Constructor Creation Book Class Create a constructor function or ES6 class for a Book object.

The Book object should store the following data in attributes: title and author. Library Class Create a constructor function or ES6 class for a Library object that will be used with the Book class. The Library object should be able to internally keep an array of Book objects.

B. Methods to add Library Class

The class should have the following methods:

o A function named simulate. In this function create a while loop that runs 30 times to simulate 30 days. Each day, iterate over all the books and checkout the book if it is not checked out, check it in if it is. Book Class

o A method named is CheckedOut that returns true if the book is checked out and false if not. o A method named CheckOut that displays “Checking Out … ” Be sure to replace with the actual title of the book.

o A method named CheckIn that displays “Checking In …” Be sure to replace with the actual title of the book.

C. Test Program After you have created the classes.

Create three Book objects and store the following data in them:

Title

Author

Item #1 Code Complete Steve McConnell

Item #2 The Art of Unit Testing Roy Osherove

Item #3 Domain Driven Design Eric Evans Store all three Book objects in an array named “catalog” in the Library class.

Next, create a Library object.

Now, call the simulate function on the library object you just created.

In: Computer Science

Consider an ADT with the same operators as a stack (push(), pop(), size(), empty()), except that...

  1. Consider an ADT with the same operators as a stack (push(), pop(), size(), empty()), except that the pop() operator returns the largest element rather than the element most recently pushed. For this to make sense, the objects on the stack must be totally ordered (e.g. numbers). Describe array and linked list implementations of the ADT. Your implementations should be as time and space efficient as you can manage. Give the running times for the CRUD operators.

In: Computer Science

In class, we have studied the bisection method for finding a root of an equation. Another...

In class, we have studied the bisection method for finding a root of an equation. Another method for finding a root, Newton’s method, usually converges to a solution even faster than the bisection method, if it converges at all. Newton’s method starts with an initial guess for a root, ?0 , and then generates successive approximate roots ?1 , ?2 , …. ?i , ?i+i, …. using the iterative formula?′(?௝) Where ?’(xi) is the derivative of function ? evaluated at ? = ?i . The formula generates a new guess, ?j+1, from a previous one, ?j . Sometimes Newton’s method will fail to converge to a root. In this case, the program should terminate after many trials, perhaps 100. The figure above shows the geometric interpolation of Newton’s method where ?0 , ?1 , and ?2 represent successive guesses for the root. At each point ?j , the derivative, ?’(xj), is the slope of the tangent to the curve, ?(?). The next guess for the root, ?j+1, is the point at which the tangent crosses the x-axis. Write a program that uses Newton’s method to approximate the nth root of a number to six decimal places. If ?n = ?, then ?n-? = 0. Finding a root of the second equation will give you n√?  . Test your program on √3, 3√10 , and 3√−2. Your program could use c/2 as its initial guess.

In: Computer Science

Program: Java (using eclipse) Write a program that asks the user to enter today’s sales for...

Program: Java (using eclipse)

Write a program that asks the user to enter today’s sales for five stores. The program should then display a bar chart comparing each store’s sales. Create each bar in the bar chart by displaying a row or asterisks. Each asterisk should represent $100 of sales. You must use a loop to print the bar chart!!!!

If the user enters a negative value for the sales amount, the program will keep asking the user to enter the sales amount until a positive amount is entered,

You must use methods, loops and arrays for this assignment!!!!!

In: Computer Science