Questions
Use C++ write a "Design and implement a class of infix calculators" ,simply write a function...

Use C++ write a "Design and implement a class of infix calculators" ,simply write a function named "evaluateInfix()" that evaluates infix expressions. It should have one string parameter and should return an int result. It should call a separate function named "infixToPostfix()" to convert the infix expression into a postfix expression, and then it should do the work of evaluating the resulting postfix expression. Then write a main() function to thoroughly test the function.

Use the pseudocode algorithm that evaluates postfix expressions given at the end of section 6.3.1 and the pseudocode algorithm that converts an infix expression to postfix form given near the end of section 6.3.2. Use the STL stack class.

Here is the pseudocode for 6.3.1

for ( each character ch in the string) {

if (ch is an operand)

Push the value of the operand ch onto the stack

else // ch is an operator named

{

// Evaluate and push the result

operand2 = top of stack

Pop the stack

operand1 = top of stack

Pop the stack

result = operand1 op operand2

Push result onto the stack

}

}

Here is the pseudocode for 6.3.2

for ( each character ch in the infix expression) {

switch (ch) {

case operand: // Append operand to end of postfix expression—step 1

postfixExp = postfixExp • ch

break

case '(': // Save '(' on stack—step 2

aStack.push(ch)

break

case operator: // Process stack operators of greater precedence—step 3

while (!aStack.isEmpty() and aStack.peek() is not a '(' and precedence(ch) <= precedence(aStack.peek())) {

Append aStack.peek() to the end of postfixExp

aStack.pop()

}

aStack.push(ch) // Save the operator

break

case ')': // Pop stack until matching '(' —step 4

while (aStack.peek() is not a '(')

{ Append aStack.peek() to the end of postfixExp

aStack.pop()

}

aStack.pop() // Remove the open parenthesis

break }

}

// Append to postfixExp the operators remaining in the stack—step 5

while (!aStack.isEmpty())

{ Append aStack.peek() to the end of postfixExp

aStack.pop()

}

In: Computer Science

In C++, write a program that reads data from a text file. Include in this program...

In C++, write a program that reads data from a text file. Include in this program functions that calculate the mean and the standard deviation. Make sure that the only global variables are the actual data points, the mean, the standard deviation, and the number of data entered. All other variables must be local to the function. At the top of the program make sure you use functional prototypes instead of writing each function before the main function... ALL LINES OF THE PROGRAM MUST BE COMMENTED.

349.5

376.2

36.9

283.5

361.0

381.0

344.7

328.5

368.3

370.5

360.6

426.9

434.7

Help please and comment on every line.

In: Computer Science

Describe the role and relationship between each high-level component of the Von Neumann Architecture? (I/O, Memory,...

Describe the role and relationship between each high-level component of the Von Neumann Architecture? (I/O, Memory, CPU, ALU). b) What are some of the differences between a Von Neumann Architecture and other computing architectures?

In: Computer Science

You are an IT company and want to get a travel agency's network design, hardware, software,...

You are an IT company and want to get a travel agency's network design, hardware, software, and security. Submit a list of all e-Commerce applications required in the travel agency's network. Make sure to include a description of each application.

In: Computer Science

Write a BASH shell script (see the Important Notes section) that acts as a DOS command...

  1. Write a BASH shell script (see the Important Notes section) that acts as a DOS command interpreter (the user enters the DOS command and the script executes the corresponding Linux command).
    • The script should loop continuously until the user enters the QUIT command
    • Prior to accepting a command, display a prompt containing your first name and the greater than symbol (>)
      • Example prompt: linux>
    • The DOS command, and any arguments, should be stored in variables
      • $command – the DOS command (required)
      • $arg1 – the first argument (optional)
      • $arg2 – the second argument (optional)
        Note: Only some DOS/Linux commands will require one or both argument variables.
    • The script should use case statements to select the appropriate Linux command
      • If an unknown DOS command is entered, display the error message, Command Not Found!
  2. Refer to the table below for a list of DOS commands and their Linux counterparts (COMMAND [ARG 1] [ARG 2])
  1. DOS Command * Linux Command
    CHDIR [target directory] cd [target directory]
    CLS clear
    COPY [source file] [destination file] cp [source file] [destination file]
    CREATEDIR [directory name] mkdir [directory name]
    CREATEFILE [file name] touch [file name]
    DELETE [file name] rm [file name]
    DIR [file name | directory name | wildcard] ls [file name | directory name | wildcard]
    MOVE [source] [destination] mv [source] [destination]
    PRINT [message to print] echo [message to print]
    QUIT N/A
    RENAME [old name] [new name] mv [old name] [new name]
    TYPE [file name] cat [file name]
    * Assume DOS commands are case-insensitive (i.e., DIR is the same as dir).

In: Computer Science

Learning Objectives: ● review implementing the interface Comparable<T> ● programming against interfaces not objects. ● review...

Learning Objectives:

● review implementing the interface Comparable<T>

● programming against interfaces not objects.

● review reading in data from a file

● use the internet to learn about the interface Comparator<T>

● use a Comparator to provide an alternative way to order elements in a

collection

Description:

Turn in:

Turn in the assignment via Canvas

Create a package called booksthat includes 3 files: Book.java, BookApp.java, and books.csv (provided).

Class Book represents Pulitzer prize winning books that have a title, an author and a year, when they won the award. Implement the class Book exactly as specified in the UML diagram below.
You are allowed to create private methods to structure your code, but fields, constructors, and public methods must not be changed nor added or removed.

Notice that class Book implements the interface Comparable<T>. The method specified in the interface is not listed in the UML class diagram of class Book. However, the fact that Book implements Comparable<T> implies that the interface method needs to be implemented.
The interface Comparable<T> implements the natural order. In case of class Book it should sort by title.

Also notice that class Book is immutable. It has getters but no setters.

Method toString:

The toString method should return a string of the following form: name by author ( year )
Make sure to include the @Override annotation

Method getList:

Note that the method getList is underlined. Underlining a method in a UML class diagrams indicates that the method is static.
The method getList should readin the data from the csv file book.csv. If a line doesn’t follow the pattern title,author,yearthen a message should be written to the standard error stream (see sample output) The program should continue reading in the next line. NO exception should be thrown .

Please note that the sample output is only provided to help clarify the instructions. The program still needs to fulfill all the requirement when I test it with another csv file (e.g. where all lines are correct or other lines have an issue)

Write a test client called BookApp.java

● It should read in the data from the file book.csv. Two lines have an issue. Treat them as described above.

● Print the number of books that were read in.

Make sure to determine the number of books at run time. I will test your code with a different csv file.

● Sort the list in natural order and print the list

Sort the books in the list in reverse order using a Comparator<T>that is provided in class Collections

● List the book in the newly reversed order

Sample Output:

Problem reading in "No Pulitzer prize for fiction was awarded in 2012" Problem reading in "The Brief, Wondrous Life of Oscar Wao,Junot Diaz,2008" Number of books read in: 14

Sorted book list:
A Visit from the Goon Squad by Jennifer Egan (2011)
Empire Falls by Richard Russo (2002)
Gilead by Marilynne Robinson (2005)
Interpreter of Maladies by Jhumpa Lahiri (2000)
March by Geraldine Brooks (2006)
Middlesex by Jeffrey Eugenides (2003)
Olive Kitteridge by Elizabeth Strout (2009)
The Amazing Adventures of Kavalier & Clay by Michael Chabon (2001) The Goldfinch by Donna Tartt (2014)
The Hours by Michael Cunningham (1999)
The Known World by Edward P. Jones (2004)
The Orphan Master's Son by Adam Johnson (2013)
The Road by Cormac McCarthy (2007)
Tinkers by Paul Harding (2010)

Reverse order:
Tinkers by Paul Harding (2010)
The Road by Cormac McCarthy (2007)
The Orphan Master's Son by Adam Johnson (2013)
The Known World by Edward P. Jones (2004)
The Hours by Michael Cunningham (1999)
The Goldfinch by Donna Tartt (2014)
The Amazing Adventures of Kavalier & Clay by Michael Chabon (2001) Olive Kitteridge by Elizabeth Strout (2009)
Middlesex by Jeffrey Eugenides (2003)
March by Geraldine Brooks (2006)
Interpreter of Maladies by Jhumpa Lahiri (2000)
Gilead by Marilynne Robinson (2005)
Empire Falls by Richard Russo (2002)
A Visit from the Goon Squad by Jennifer Egan (2011)

In: Computer Science

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