Questions
[C++] Write an algorithm to transfer the elements from queue Q1 to queue Q2, so that...

[C++]

Write an algorithm to transfer the elements from queue Q1 to queue Q2, so that the contents in Q2 will be in reverse order as they are in Q1 (e.g. if your queue Q1 has elements A, B, and C from front to rear, your queue Q2 should have C, B, and A from front to rear). Your algorithm must explicitly use an additional stack to solve the problem. Write your algorithm in pseudo code first.

In: Computer Science

Requirements:   You are to write a class called Point – this will represent a geometric point...

Requirements:   You are to write a class called Point – this will represent a geometric point in a Cartesian plane (but x and y should be ints).   Point should have the following:

Data:  

  • that hold the x-value and the y-value. They should be ints and must be private.

Constructors:

  • A default constructor that will set the values to (2,-7)
  • A parameterized constructor that will receive 2 ints (x then y) and set the data to what is received.
  • A copy constructor that will receive a Point. If it receives null, then it should

throw new IllegalArgumentException(<”your meaningful String here”>);

If it is OK, the it should initialize the data (of the new instance being created) to be the same as the Point that was received.

Methods:

  • The methods to be implemented are shown in the PointInterface.java. You can look at this file to see the requirements for the methods.
  • Your Point class should be defined like this:

public class Point implements PointInterface

When your Point.java compiles, Java will expect all methods in the interface to be implemented and will give a compiler error if they are missing. The compiler error will read “class Point is not abstract and does not implement method ”.

You can actually copy the PointInterface methods definitions into your Point class so it will have the comments and the method headers.   If you do this, be sure to take out the ; in the method headers or you will get a “missing method body” syntax error when compiling…

  • But a toString() method and a .equals(Object obj) method are automatically inherited from the Object class. So if you do not implement them, Java will find and use the inherited ones – and will not give a compiler error (but the inherited ones will give the wrong results). The Point class should have its own .toString and .equals methods.
  • ==============================================================================
  • This is the interface (called PointInterface.Java) for a Point class (which will represent a 2-dimensional Point)
  • public interface PointInterface

    {

    // toString

    // returns a String representing this instance in the form (x,y)

    (WITHOUT a space after the ,)

    public String toString();

    // distanceTo

    // throws a new IllegalArgumentException(

    if null is received

    // returns the distance from this Point to the Point that was

    received

    // NOTE: there is a static method in the Math class called hypot

    can be useful for this method

    public double distanceTo(Point otherPoint);

    //equals - returns true if it is equal to what is received (as an Object)

    public boolean equals(Object obj);

    // inQuadrant

    // returns true if this Point is in the quadrant specified

    // throws a new IllegalArgumentException if the quadrant is

    out of range (not 1-4)

    public boolean inQuadrant(int quadrant);

    // translate

    // changes this Point's x and y value by the what is received (thus

    "translating" it)

    // returns nothing

    public void translate(int xMove, int yMove);

    // onXAxis

    // returns true if this Point is on the x-axis

    public boolean onXAxis();

    // onYAxis

    // returns true if this Point is to the on the y-axis

    public boolean onYAxis();

    //=============================================

    // The method definitions below are commented out and

    // do NOT have to be implemented

    // //===========================================

    // halfwayTo

    // throws a new IllegalArgumentException(

    if null is received

    // returns a new Point which is halfway to the Point that is

    received

    //public Point halfwayTo(Point another);

    // slopeTo

    // throws a new IllegalArgumentException(

    if null is received

    // returns the slope between this Point and the one that is

    received.

    // since the slope is (changeInY/changeInX), then first check to see if

    changeInX is 0

    // if so, then return Double.POSITIVE_INFINITY; (since the

    denominator is 0)

    //public double slopeTo(Point anotherPoint)

    }

In: Computer Science

(a)Design an algorithm that takes two numeric strings s1 and s2 and return another numeric string...

(a)Design an algorithm that takes two numeric strings s1 and s2 and return another numeric string that represent their sum without using using SHIFT OR any operator +.

(b) Analyze time and space of part (a)

(c)Implement part (a) in your favorite programming language without using 0+0 operator. You

should read the two numeric strings from a FILE input.in and output their addition to standard output.

You Solution will be test on 10,000 test cases. Each test case will include two randomly selected numbers.

i want it in c program

positive number

In: Computer Science

Classful Subnetting Given the following IP address of 212.134.99.112 with a subnet mask of 255.255.255.224 Class...

Classful Subnetting

  1. Given the following IP address of 212.134.99.112 with a subnet mask of 255.255.255.224
    1. Class of the IP address:
    2. Net ID for this IP address:
    3. Total number of subnets:
    4. First address (subnet ID) and the Last address (broadcast address) that 21.134.99.112 belongs to:

  1. Find the subnet masks that create the following number of valid subnets in a Class B address.     

# Valid Subnets Needed

Subnet Mask

2

250

30

510

5

120

  1. Give the maximum number of total subnets in Class C using the following masks.

Subnet Mask

# Total Subnets Created

255.255.255.192

255.255.255.248

255.255.255.224

  1. For the following subnet masks used in Class B, find the number of bits reserved for defining the subnet:

Subnet Mask

# Subnet Bits

255.255.192.0

255.255.255.192

255.255.240.0

255.255.255.252

  1. An organization is granted the block 135.0.0.0. The administrator wants to create 1024 total subnets. Find the following:
    1. Subnet mask:
    2. Number of host bits:
    3. First and last address (subnet ID & broadcast) in the first valid subnet.
    1. Find the first and last valid host addresses in the last valid subnet.

  1. Write the following masks in the CIDR notation (/n format).

Subnet Mask

/n format

255.255.0.0

255.224.0.0

255.255.255.128

255.255.248.0

  1. An organization was assigned 116.0.0.0. They created a subnet mask of 255.255.255.128. Are the following addresses valid (can be assigned to hosts)? If not, explain why.

IP Address

Valid? (Y/N)

116.0.0.50

116.0.0.167

116.1.45.232

116.255.254.128

116.128.128.254

116.13.0.255

In: Computer Science

The gravitational attractive force between two bodies with masses m1 and m2 separated by a distance...

The gravitational attractive force between two bodies with masses m1 and
m2 separated by a distance d is given by:
F = Gm1m2
d 2
where G is the universal gravitational constant:
G = 6.673 × 10−8 cm3
g × sec2
Write a function definition that takes arguments for the masses of two bod-
ies and the distance between them and that returns the gravitational force.
Since you will use the preceding formula, the gravitational force will be in
dynes. One dyne equals
g × cm
sec2
You should use a globally defined constant for the universal gravitational
constant. Embed your function definition in a complete program that
computes the gravitational force between two objects given suitable inputs.
Your program should allow the user to repeat this calculation as often as
the user wishes.

C++

the programming language is C++

In: Computer Science

This assignment is For a C++ class , I am having difficulty with getting the boolean...

This assignment is For a C++ class , I am having difficulty with getting the boolean statements the most; getting them set up properly inside the int main() area.

You have been asked to define a tip-calculating function named calcTip that could be integrated into a larger piece of software designed to improve guest service at a restaurant. As a result, you must conform to the function specification used throughout the rest of the project's code:

double calcTip(double checkAmount, bool postTax, bool round);

This function, when called, calculates and returns a tip amount in U.S. dollars determined by the values of its two boolean parameters. Any extra comments with guidance will be very apprectiated, thank you so much!
----

tipCalc's parameters:

checkAmount:

The amount of a check in U.S. dollars with tax included.
Ex. a value of 15.00 represents $15.00 USD.

postTax:

The value of the postTax parameter determines whether the function calculates a tip before or after the tax has been added to a check amount.

A value of true means that the calculated tip will be based off the entire check amount.

A value of false indicates that tax must be removed from the check amount before a tip is calculated.

round:

The value of the round parameter determines whether or not the tip amount is rounded up before being returned. A value of true indicates that the value will be rounded up.


----


Assume that the tax rate for meals is a fixed 7.8% regardless of the geographical region in which
this software may be used. Also, in the interest of elevating the standard of what constitutes a
good tip, the tip rate is a fixed 20%.

As examples, a tip calculated for an entire $20.00 check (which includes tax) without rounding would be $4.00. A tip calculated for only the pre-tax amount of a $20.00 check without rounding would be $3.69.


Implementation


You must not make any changes to the calcTip's return type or parameters.


----


In main, you must prompt for and accept user input that will be used as arguments for a calcTip function call.

You have the freedom to structure main as you see fit, provided that I can execute your program and specify the following before a call to calcTip is made:

1.) the amount of the check after tax has been applied (e.g. I can enter $20.00 or similar)
2.) whether or not I want my tip to be calculated off the full check (i.e. including tax)
3.) whether or not I want to round up my tip to the nearest U.S. dollar

You must not prompt for this input inside calcTip().


----


Once this is done, a function call to calcTip must be made inside main; its return value
will be output.


Results

Output the following text in main after making the call to calcTip:

Your tip amount is $[TIP AMOUNT]

In order to verify program correctness, you should run the program four times under the following conditions:

1.) The user wants a 20% tip on a $15 check before tax with no rounding.
2.) The user wants a 20% tip on a $15 check after tax with no rounding.
3.) The user wants a 20% tip on a $15 check before tax with rounding.
4.) The user wants a 20% tip on a $15 check after tax with rounding.

In: Computer Science

Java Beginner a)Create a class named Student that has fields for an ID number, number of...

Java Beginner

a)Create a class named Student that has fields for an ID number, number of credit hours earned, and number of points earned. (For example, many schools compute grade point averages based on a scale of 4, so a three-credit-hour class in which a student earns an A is worth 12 points.) Include methods to assign values to all fields. A Student also has a field for grade point average. Include a method to compute the grade point average field by dividing points by credit hours earned. Write methods to display the values in each Student field. Save this class as Student.java.

b)Write a class named ShowStudent that instantiates a Student object from the class you created and assign values to its fields. Compute the Student grade point average, and then display all the values associated with the Student. Save the application as ShowStudent.java.

c)Create a constructor for the Student class you created. The constructor should initialize each Student’s ID number to 9999, his or her points earned to 12, and credit hours to 3 (resulting in a grade point average of 4.0).Write a program that demonstrates that the constructor works by instantiating an object and displaying the initial values. Save the application as ShowStudent2.java.

In: Computer Science

Suggest possible security strategies needed to support encryption and network access control.

Suggest possible security strategies needed to support encryption and network access control.

In: Computer Science

Represent the following numbers in binary 8-bit representation using singed magnitude, one's complement, two's complement, and...

Represent the following numbers in binary 8-bit representation using singed magnitude, one's complement, two's complement, and excess-127 representations:

a) 48

b) -35

In: Computer Science

What are the standard Python modules for handling standard output? How do you program reread data...

What are the standard Python modules for handling standard output?
How do you program reread data from standard input?
What happens when an exception is raised and the program does not handle it with a try/except statement?
What type of exception does a program raise when it tries to open a nonexistent file?
What type of exception does a program raise when it uses the float number to convert a non-numeric string to a number?
What important statement do you need to write in a program that uses the math module?

In: Computer Science

I am using NetBeans IDE Java to code and I am seeking comment to the code...

I am using NetBeans IDE Java to code and I am seeking comment to the code as well (for better understanding).

  1. Magic squares. An n x n matrix that is filled with the numbers 1, 2, 3, …, n2 is a magic square if the sum of the elements in each row, in each column, and in the two diagonals is the same value.

Write a program that reads in 16 values from the keyboard, displays them in a 4 x 4 array, and tests whether they form a magic square.

Example:

              16     3       2      13

               5      10     11     8

               9       6       7      12

               4       15    14     1

You need to test two features:

  1. Does each of the numbers 1, 2, …., 16 occur in the user input?
  2. When the numbers are put into a square, are the sums of the rows, columns, and diagonals equal to each other?

Hint: use a two-dimentional array.

  1. Implement a class Robot that simulates a robot wandering on an infinite plane. The robot is located at a point with integer coordinates and faces north, east, south, or west. Supply methods:

public void turnLeft()

public void turnRight()

public void move()

public Point getLocation()

public String getDirection()

The turnLeft and turnRight methods change the direction but not the location. The move method moves the robot by one unit in the direction it is facing. The getDirection method returns a string "N", "E", "S", or "W".

In: Computer Science

Use the Galton dataset from the mosaicData package in R STUDIO library(mosaic) Create a scatter plot...

  1. Use the Galton dataset from the mosaicData package in R STUDIO

library(mosaic)

  1. Create a scatter plot to show the relationship between height against father’s height (x=father, y=height)

  2. What relationship did you see? (Use comments to write in your R Markdown file)

  3. Separate your plot into facets by sex

  4. Add a regression line using the “lm” method to both of your facets

  5. Generate a box plot of height by sex.

  1. Use the RailTrail data from the mosaicData package

library(mosaic)

  1. Generate a scatter plot to show the relationship between the number of crossings per day volume against the high temperature that day

  2. Separate your plot to facets by weekday

In: Computer Science

How does Microsoft use product design and production engineering play in the reduction of the impact...

How does Microsoft use product design and production engineering play in the reduction of the impact of technology waste on the environment

In: Computer Science

C++ Description: You will write a program that reads students names followed by their final grade....

C++

Description: You will write a program that reads students names followed by their final grade. It will output the names and their grade, followed by the corresponding letter grade. It will also print the name of the students(s) with the highest grade

  • Student data will be stored in a struct called studentType which has 4 members:
    • fName
    • lName
    • score
    • letterGrade
  • Assume there are 20 students
  • Your main() function will only have variable definitions and function calls
    • You MUST have the following functions
      • readData
      • assignGrade
      • findHighest
      • printHighest

In: Computer Science

23. ASCII is a 7-bit code, while Unicode is a 16-bit code. True or False? Explain...

23. ASCII is a 7-bit code, while Unicode is a 16-bit code. True or False? Explain
24. Binary-coded decimal (BCD) can be used to store two decimal digits in one byte. True or False? Explain
25. Reed-Solomon codes can effectively deal with burst errors. True or False? Explain
26. Hamming Codes are used for __________ bit errors. Explain
27. Describe the Principle of Equivalence of Software and Hardware. What is the caveat to it? Explain

In: Computer Science