Questions
C++ Question1. Create a class called Rantional for performing arithmatic with fractions. Then write a program...

C++

Question1. Create a class called Rantional for performing arithmatic with fractions. Then write a program to test your class. Use integer variables to represent the private data of the class, meaning the numerator and the denominator. Provide a constructor that enables an object of this class to be initialized when it's declared. The constructor should contain default values in

case no initializers are provided and should store the fraction in reduced form. For example fraction 2/4 would be stored in the object as 1 for the numerator and 2 for the denominator.
Note: Remember that denominator cannot be 0.
Provide public member functions that perform each of the following tasks:
a) add -- Adds 2 rational numbers. Result should be stored in reduced form.
b) subtract -- Subtracts 2 rational numbers. Store result in reduced form.
c) multiply -- Multiplies 2 rational numbers. Store result in reduced form.
Write a main() function to test above functionalites.

In: Computer Science

Assume a 2.8 MByte file is being uploaded from a client application to a web server....

Assume a 2.8 MByte file is being uploaded from a client application to a web server. Answer the following questions from the perspective of the protocol stack on the client.

a. What protocol is in use at the application layer?

b. Is this application layer protocol reliable?

c. The application layer hands this 2.8 MByte file to the transport layer. What protocol is in use at the transport layer?

d. Is this transport layer protocol reliable?

e. Is this transport layer protocol connection oriented or connection-less?

f.What does the transport layer do with this 2.8 MByte file?

g. The transport layer then hands its data off to what layer?

h. What is the responsibility of this next layer?

In: Computer Science

Question #14. a. TRUE OR FALSE: Code written using a case/switch construct can always be rewritten...

Question #14. a. TRUE OR FALSE: Code written using a case/switch construct can always be rewritten using an if/else construct. Explain why or why not. b. TRUE OR FALSE: Code written using an if/else construct can always be rewritten using a case/switch construct. Explain why or why not.

matlab

In: Computer Science

(MATLAB) im trying to solve an equation for gravitational force for 41 radius values in between...

(MATLAB) im trying to solve an equation for gravitational force for 41 radius values in between 3.8e8 to 4e8, heres a snippet of the code... how would a create this equation to solve for all 43 values (3.8e8 - additional 41 values in between- 4e8) the values are evenly spaced. (MATLAB)

r=(3.8e8:(2e7/42):4e8);
Mass_earth=5.97e24;
Mass_moon=7.34e22;
Force=((G*Mass_earth*Mass_moon)/(r^2));
fprintf(''),disp(Force(1))

In: Computer Science

Describe the different functions of a RADIUS server? Describe how we use Network Policies? Describe how...

  1. Describe the different functions of a RADIUS server?

  1. Describe how we use Network Policies?

  1. Describe how we use the different NAS type?

  1. Describe the different templates with the RADUIS server?

  1. What’s the most secure NAP enforcement method?

  1. What is the wdsnbp.com file?

In: Computer Science

What output is produced by the following code fragment? int num = 0, max = 20;...

What output is produced by the following code fragment?

int num = 0, max = 20;

while (num < max)

{

System.out.println(num);

num += 4;

}

In: Computer Science

Posting 3 times , still not get right answer (The MyInteger class) Design a class named...

Posting 3 times , still not get right answer

(The MyInteger class) Design a class named MyInteger. The class contains:

* An int data field named value that stores the int value represented by this object.

* A constructor that creates a MyInteger object for the specified int value. A getter method that returns the int value.

* The methods isEven(), isOdd(), and isPrime() that return true if the value in this object is even, odd, or prime, respectively.

* The static methods isEven(int), isOdd(int), and isPrime(int) that return true if the specified value is even, odd, or prime, respectively.

* The static methods isEven(MyInteger), isOdd(MyInteger), and isPrime(MyInteger) that return true if the specified value is even, odd,or prime, respectively.

* The methods equals(int) and equals(MyInteger) that return true if the value in this object is equal to the specified value.

* A static method parseInt(char[]) that converts an array of numeric characters to an int value.

* A static method parseInt(String) that converts a string into an int value.

Write a client program that tests all methods in the class. Given that the definition of a prime number is a positive integer be sure to instruct the use to only enter positive integers.

SAMPLE RUN #1

--- Prompts For Keyboard/Console/Standard Input ---

Enter a positive integer to create a MyInteger object or to move on to next part of program:
Enter a positive integer to test static isXXX(int) methods or to move on to next part of program:
Enter a positive integer to test static isXXX(MyInteger) methods or to move on to next part of program:
Enter a the first of two positive integers to create obj2 and test obj2.equals(int) or to move on to next part of program:
Enter a the second of two positive integers to test obj2.equals(int):
Enter a the first of two positive integers to create obj2 and test obj2.equals(MyInteger obj3) or to move on to next part of program:
Enter a the second of two positive integers to create obj3 and test obj2.equals(MyInteger obj3):
Enter a positive integer that will be placed into a char[] array to demonstrate the MyInteger.parseInt(char[]):
Enter a positive integer that will be placed into a String to demonstrate the MyInteger.parseInt(String):

Inputs

--- Keyboard/Console/Standard Input stdin ---

1
2
3
7
8

1
2
19
23
24

1
2
5
22
19

22
22
33
33
33
34

11
11
1
1
1
2

125
256

333
444
987

Outputs

--- Monitor/Console/Standard Output ---

Enter a positive integer to create a MyInteger object or to move on to next part of program:MyInteger obj0 = new MyInteger(1);
obj0.getValue() = 1
obj0.isEven() = false
obj0.isOdd() = true
obj0.isPrime() = false
Enter a positive integer to create a MyInteger object or to move on to next part of program:MyInteger obj0 = new MyInteger(2);
obj0.getValue() = 2
obj0.isEven() = true
obj0.isOdd() = false
obj0.isPrime() = true
Enter a positive integer to create a MyInteger object or to move on to next part of program:MyInteger obj0 = new MyInteger(3);
obj0.getValue() = 3
obj0.isEven() = false
obj0.isOdd() = true
obj0.isPrime() = true
Enter a positive integer to create a MyInteger object or to move on to next part of program:MyInteger obj0 = new MyInteger(7);
obj0.getValue() = 7
obj0.isEven() = false
obj0.isOdd() = true
obj0.isPrime() = true
Enter a positive integer to create a MyInteger object or to move on to next part of program:MyInteger obj0 = new MyInteger(8);
obj0.getValue() = 8
obj0.isEven() = true
obj0.isOdd() = false
obj0.isPrime() = false
Enter a positive integer to create a MyInteger object or to move on to next part of program:Enter a positive integer to test static isXXX(int) methods or to move on to next part of program:MyInteger.isEven(1) = false
MyInteger.isOdd(1) = true
MyInteger.isPrime(1) = false
Enter a positive integer to test static isXXX(int) methods or to move on to next part of program:MyInteger.isEven(2) = true
MyInteger.isOdd(2) = false
MyInteger.isPrime(2) = true
Enter a positive integer to test static isXXX(int) methods or to move on to next part of program:MyInteger.isEven(19) = false
MyInteger.isOdd(19) = true
MyInteger.isPrime(19) = true
Enter a positive integer to test static isXXX(int) methods or to move on to next part of program:MyInteger.isEven(23) = false
MyInteger.isOdd(23) = true
MyInteger.isPrime(23) = true
Enter a positive integer to test static isXXX(int) methods or to move on to next part of program:MyInteger.isEven(24) = true
MyInteger.isOdd(24) = false
MyInteger.isPrime(24) = false
Enter a positive integer to test static isXXX(int) methods or to move on to next part of program:Enter a positive integer to test static isXXX(MyInteger) methods or to move on to next part of program:MyInteger obj1 = new MyInteger(1);
obj1.getValue() = 1
MyInteger.isEven(obj1) = false
MyInteger.isOdd(obj1) = true
MyInteger.isPrime(obj1) = false
Enter a positive integer to test static isXXX(MyInteger) methods or to move on to next part of program:MyInteger obj1 = new MyInteger(2);
obj1.getValue() = 2
MyInteger.isEven(obj1) = true
MyInteger.isOdd(obj1) = false
MyInteger.isPrime(obj1) = true
Enter a positive integer to test static isXXX(MyInteger) methods or to move on to next part of program:MyInteger obj1 = new MyInteger(5);
obj1.getValue() = 5
MyInteger.isEven(obj1) = false
MyInteger.isOdd(obj1) = true
MyInteger.isPrime(obj1) = true
Enter a positive integer to test static isXXX(MyInteger) methods or to move on to next part of program:MyInteger obj1 = new MyInteger(22);
obj1.getValue() = 22
MyInteger.isEven(obj1) = true
MyInteger.isOdd(obj1) = false
MyInteger.isPrime(obj1) = false
Enter a positive integer to test static isXXX(MyInteger) methods or to move on to next part of program:MyInteger obj1 = new MyInteger(19);
obj1.getValue() = 19
MyInteger.isEven(obj1) = false
MyInteger.isOdd(obj1) = true
MyInteger.isPrime(obj1) = true
Enter a positive integer to test static isXXX(MyInteger) methods or to move on to next part of program:Enter a the first of two positive integers to create obj2 and test obj2.equals(int) or to move on to next part of program:MyInteger obj2 = new MyInteger(22);
obj2.getValue() = 22
Enter a the second of two positive integers to test obj2.equals(int):obj2.equals(22) = true
Enter a the first of two positive integers to create obj2 and test obj2.equals(int) or to move on to next part of program:MyInteger obj2 = new MyInteger(33);
obj2.getValue() = 33
Enter a the second of two positive integers to test obj2.equals(int):obj2.equals(33) = true
Enter a the first of two positive integers to create obj2 and test obj2.equals(int) or to move on to next part of program:MyInteger obj2 = new MyInteger(33);
obj2.getValue() = 33
Enter a the second of two positive integers to test obj2.equals(int):obj2.equals(34) = false
Enter a the first of two positive integers to create obj2 and test obj2.equals(int) or to move on to next part of program:Enter a the first of two positive integers to create obj2 and test obj2.equals(MyInteger obj3) or to move on to next part of program:MyInteger obj2 = new MyInteger(11);
obj2.getValue() = 11
Enter a the second of two positive integers to create obj3 and test obj2.equals(MyInteger obj3):MyInteger obj3 = new MyInteger(11);
obj3.getValue() = 11
obj2.equals(obj3) = true
Enter a the first of two positive integers to create obj2 and test obj2.equals(MyInteger obj3) or to move on to next part of program:MyInteger obj2 = new MyInteger(1);
obj2.getValue() = 1
Enter a the second of two positive integers to create obj3 and test obj2.equals(MyInteger obj3):MyInteger obj3 = new MyInteger(1);
obj3.getValue() = 1
obj2.equals(obj3) = true
Enter a the first of two positive integers to create obj2 and test obj2.equals(MyInteger obj3) or to move on to next part of program:MyInteger obj2 = new MyInteger(1);
obj2.getValue() = 1
Enter a the second of two positive integers to create obj3 and test obj2.equals(MyInteger obj3):MyInteger obj3 = new MyInteger(2);
obj3.getValue() = 2
obj2.equals(obj3) = false
Enter a the first of two positive integers to create obj2 and test obj2.equals(MyInteger obj3) or to move on to next part of program:Enter a positive integer that will be placed into a char[] array to demonstrate the MyInteger.parseInt(char[]):MyInteger obj4 = new MyInteger(MyInteger.parseInt(char []);
obj4.getValue() = 125
obj4.isEven() = false
obj4.isOdd() = true
obj4.isPrime() = false
Enter a positive integer that will be placed into a char[] array to demonstrate the MyInteger.parseInt(char[]):MyInteger obj4 = new MyInteger(MyInteger.parseInt(char []);
obj4.getValue() = 256
obj4.isEven() = true
obj4.isOdd() = false
obj4.isPrime() = false
Enter a positive integer that will be placed into a char[] array to demonstrate the MyInteger.parseInt(char[]):Enter a positive integer that will be placed into a String to demonstrate the MyInteger.parseInt(String):MyInteger obj5 = new MyInteger(MyInteger.parseInt(String);
obj5.getValue() = 333
obj5.isEven() = false
obj5.isOdd() = true
obj5.isPrime() = false
Enter a positive integer that will be placed into a String to demonstrate the MyInteger.parseInt(String):MyInteger obj5 = new MyInteger(MyInteger.parseInt(String);
obj5.getValue() = 444
obj5.isEven() = true
obj5.isOdd() = false
obj5.isPrime() = false
Enter a positive integer that will be placed into a String to demonstrate the MyInteger.parseInt(String):MyInteger obj5 = new MyInteger(MyInteger.parseInt(String);
obj5.getValue() = 987
obj5.isEven() = false
obj5.isOdd() = true
obj5.isPrime() = false
Enter a positive integer that will be placed into a String to demonstrate the MyInteger.parseInt(String):

In: Computer Science

Please use very basic level of bluej thanks (please dont use advance techniques ) Write a...

Please use very basic level of bluej thanks (please dont use advance techniques )

Write a class House that represents a house. It should contain instance data: house number, street, town, year when the house was built. Define House’s constructor to accept and initialize all instance data. Include getter (accessor) and setter (mutator) methods for all instance data. Provide a toString method that returns one line description of the house as String. Provide method isHistoric() that returns a boolean indicating if the house was older than 50 from now or not.

Create a TestHouse class with main method in it. Within main method instantiate three House objects of your choice. At least one home should be historic. For each object invoke methods toString and isHistoric, and also invoke different pair of getter and setter methods. Provide appropriate print statements to explain the result of each invoked method to user.

In: Computer Science

Download Jupyter and complete your Assignment. Be sure to write and run the code separately for...

Download Jupyter and complete your Assignment. Be sure to write and run the code separately for each part. Please provide explanation for the code logic behind the code you write / design.

First part: Create Simple Student Class with constructor to get first name and last name.

Second part: Then create Address class with the constructor to get Student Address, the parameters can be , House/Apt Number, Street, Zip, State.

Third part: Modify Student Class so that it will get House/Apt Number, Street, Zip, State. and save address inside the Student as dictionary. Also implement the function in student class that print all addresses in the Student Class.

In: Computer Science

Write a java program that randomizes a list and sorts it. The list will be randomized...

Write a java program that randomizes a list and sorts it.

  1. The list will be randomized to be at least 12 elements and no more than 30 elements with values between 1 and 100.
  2. You will submit one program with two sorts done separately within the program. The list will be re-randomized before reach sort.
  3. Write a flowchart for each sort.

In: Computer Science

Create a class to represent a Mammal object that inherits from (extends) the Animal class. View...

Create a class to represent a Mammal object that inherits from (extends) the Animal class.

View javadoc for the Mammal class and updated Animal class in homework 4

http://comet.lehman.cuny.edu/sfakhouri/teaching/cmp/cmp326/s19/hw/hw4/

Use the description provided below in UML.

Mammal
- tailLength : double
- numLegs : int

+ Mammal()
+ Mammal(double, int)
+ Mammal(String, int, double, double, char, double, int) //pass values to parent’s overloaded constructor
                                                          //and assign valid values to tailLength, numLegs or -1 if invalid

+ setTailLength(double) : void    //if the value is invalid set tailLength to -1
+ getTailLength() : double
+ setNumLegs(int) : void           //if the value is invalid set numLegs to -1
+ getNumLegs() : int
+ printDetails() : void         @Override  //see Note1:
+ toString() : String         @Override  //see Note1:
+ equals(Object) : boolean     @Override  //see Note2:

NOTE1: 
For both the printDetails() and toString() methods include the data from the Animal class, as well as Mammal attributes.  Format the Mammal data as “Mammal: Tail Length: %10.2f | Number of Legs: %4d\n”
Hint: Use super.printDetails() and super.toString()

NOTE2:
For the equals(Object) method, two Mammal objects are considered equal if the 
parent class’s equals method returns true, 
if their numLegs are equal, 
and their tailLength values are within .1 of each other

View javadoc for the Mammal class and updated Animal class in homework 4

http://comet.lehman.cuny.edu/sfakhouri/teaching/cmp/cmp326/s19/hw/hw4/

In: Computer Science

You just landed a job working for a real estate manager. Until now he has been...

You just landed a job working for a real estate manager. Until now he has been doing all his record keeping using paper and pencil. Your boss has finally decided the time has come to purchase a new software system. Your job is to find and compare software options. Find at least five different software options for real estate managment. At least one should be a "Software as a service", one should be "off the shelf", and one should be "proprietary". 1) list each option together with its advantages, disadvantages, and probable cost. 2) make a recommendation for which one you think your boss should go with and why (you can be creative on what the company looks like when deciding why)

In: Computer Science

Write a java program that prints to the screen a countdown 2,4,6,8, and then "Who do...

  1. Write a java program that prints to the screen a countdown 2,4,6,8, and then "Who do we appreciate!" (hint use a for loop).

  2. Create a java program which prints out a random goodwill message i.e. (Have a great day!) please have at least 4 messages.

  3. Write a java program that will ask the user to enter a number and print out to the screen until the number -3 is entered.

  4. Write a JAVA program that calls a method that finds the smaller of two numbers input.

In: Computer Science

use c++ Provide a header file as well. So for this question provide Rational.h, Rantional.cpp Create...

use c++

Provide a header file as well. So for this question provide Rational.h, Rantional.cpp

Create a class called Rantional for performing arithmatic with fractions. Then write a program to test your class. Use integer variables to represent the private data of the class, meaning the numerator and the denominator. Provide a constructor that enables an object of this class to be initialized when it's declared. The constructor should contain default values in case no initializers are provided and should store the fraction in reduced form. For example fraction 2/4 would be stored in the object as 1 for the numerator and 2 for the denominator.
Note: Remember that denominator cannot be 0.
Provide public member functions that perform each of the following tasks:
a) add -- Adds 2 rational numbers. Result should be stored in reduced form.
b) subtract -- Subtracts 2 rational numbers. Store result in reduced form.
c) multiply -- Multiplies 2 rational numbers. Store result in reduced form.
Write a main() function to test above functionalites.

Post your output

In: Computer Science

Phyton Please!! Make a program where you enter a dollar amount and the program tells you...

Phyton Please!!

Make a program where you enter a dollar amount and the program tells you how many $5 bills and $1 bills you will receive. Don’t use a dollar amount that equality of 5.

Example:

Enter Amount: (user inserts value)

Amount Entered: $50.00

5 dollar bills: 5

1 dollar bills: 25

In: Computer Science