Questions
2.20 Domain Lab 3.1 -- Velocity Calculator You may (or may not) need the following constants:...

2.20 Domain Lab 3.1 -- Velocity Calculator

You may (or may not) need the following constants:

  • Pi = 3.14
  • Speed of Light (c) = .307 parsecs/year
  • Gravity (g) = 9.81 m/s squared

Velocity Calculator Your program should ask the user (in this order) for:

  • Initial Velocity
  • Acceleration
  • A Time Period

Your program should then calculate and display the resulting final velocity based on the inputs provided.

In: Computer Science

in java please: Given any integer, print an English phrase that describes the integer (e.g. “One...

in java please:

Given any integer, print an English phrase that describes the integer (e.g. “One Thousand, Two Hundred Thirty Four”). An ArrayList must be used in your program.

In: Computer Science

In Python: Write a function called sum_odd that takes two parameters, then calculates and returns the...

In Python:

Write a function called sum_odd that takes two parameters, then calculates and returns the sum of the odd numbers between the two given integers. The sum should include the two given integers if they are odd. You can assume the arguments will always be positive integers, and the first smaller than or equal to the second.

To get full credit on this problem, you must define at least 1 function, use at least 1 loop, and use at least 1 decision structure.

Examples:

sum_odd(0, 5) should return the value 9 as (1 + 3 + 5) = 9

sum_odd(6, 10) should return the value 16

sum_odd(13, 20) should return the value 64

sum_odd(7, 11) should return the value 27

In: Computer Science

Write a recursive and an iterative function to calculate the nth element in a Fibonacci sequence....

Write a recursive and an iterative function to calculate the nth element in a Fibonacci sequence. A Fibonacci sequence is defined as the element 1, followed by another 1, and each element thereafter is the sum of the previous two elements. For example, the first 9 elements of a Fibonacci sequence are:

  • 1 2 3 5 8 13 21 34

This famous sequence was originally used to predict the growth of rabbit populations!

Once you have each of the functions working for n equal to 40, determine which method is more efficient by timing the two separate function calls and printing out the time required for each method call to return the 40th element in the sequence. Return the 40th element to main and print it. After that, print out a complete Fibonacci sequence from element 1 to element 40, along with its position number.

  1. 1
  2. 1
  3. 2
  4. 3

.       .

.       .

This last part should not be timed.

The timer function you need for this Project is:

                        Date d1 = new Date();

                        long milliseconds = D1.getTime();

                                                OR

                        long start = System.currentTimeMillis();

Turn in the source, output, and a short paragraph explaining the reason the two methods took different amounts of time to execute.

Please write in JAVA

and please write recursive part and iterative part separate!

In: Computer Science

DATA MINING : Find an interesting data set on the Web. Provide a high level description...

  1. DATA MINING : Find an interesting data set on the Web. Provide a high level description of the data set and minimally give its name, location, number of features (with some discussion of the feature types), and number of entries. Describe how data mining can be applied to it (e.g., for classification, etc.) and describe why you think it is interesting.

In: Computer Science

There are PRO's and CON's to mounting and emulating the suspect system. Post a short discussion...

There are PRO's and CON's to mounting and emulating the suspect system. Post a short discussion item on some PRO's and CON's of booting up a forensic image.

In: Computer Science

wireless vulnerabilies

wireless vulnerabilies

In: Computer Science

Given an IP address of 220.84.9.123 and a subnet mask of 255.255.255.240 Write down the address...

  1. Given an IP address of 220.84.9.123 and a subnet mask of 255.255.255.240

Write down the address of the network, show your calculation.

Write also the broadcast address

2. On a network with an IP address of 133.133.133.13 and a subnet mask of 255.255.248.0 what is the network ID?  Show your calculation.  Write also the broadcast address

  1. On a Class C network, you have a subnet mask of 255.255.255.192.  
  1. How many hosts per subnet do you have?
  2. On how many subnets was divided this class C address?  Show your calculations.

4. Your company has leased a Class C network whose network ID is 222.91.37.0. You want to create 30 subnets within this network. Show how many bits, you would need to change, and the range of addresses in one of the subnets.

In: Computer Science

Direct memory access is used for high-speed I/O devices in order to avoid increasing the CPU's...

Direct memory access is used for high-speed I/O devices in order to avoid increasing the CPU's execution load.

(a) What does the CPU do to interface with the device to coordinate the transfer?
(b) How does the CPU know when the memory operations are complete?
(c) The CPU is allowed to execute other programs while the DMA controller is transferring data. Does DMA interfere with the execution of the other programs? If so, describe what form of interference are caused.


In: Computer Science

1.Which of the following is a DML operation on table employee? change an employee's stree address...

1.Which of the following is a DML operation on table employee?

change an employee's stree address

cancel the insertion of 3 new employees in table employee

add a column phone2 to table employee to limit the salary amount to be at most $200,000

add a constraint in table employee to limit the salary amount to be at most $200,000

In: Computer Science

15.1 File IO Warm-up For this exercise, you will receive two string inputs, which are the...

15.1 File IO Warm-up

For this exercise, you will receive two string inputs, which are the names of the text files. You need to check if the input file exists. If input file doesn't exist, print out "Input file does not exist."

You are required to create 4 functions:

void removeSpace (ifstream &inStream, ofstream &outStream): removes white space from a text file and write to a new file. If write is successful, print out "Text with no white space is successfully written to outFileName."

int countChar (ifstream &inStream): returns number of character in input file.

int countWord(ifstream &inStream): returns number of words in input file.

int countLines(ifstream &inStream): returns number of lines in input file.

After calling each function, you have to reset the state flags and move the stream pointer to beginning of file. You can do that by closing and re-opening the file, or by calling member functions:

inStream.clear(); inStream.seekg(0);

Example:

Input: input.txt output.txt

Output:

Text with no white space is successfully written to output.txt.

Number of characters is: 154

Number of words is: 36

Number of lines is: 10

here is the code in C++:

#include <iostream>
#include <fstream>
#include <string>

using namespace std;

void removeSpace(ifstream &inStream, ofstream &outStream);
int countChar (ifstream &inStream);
int countWords(ifstream &inStream);
int countLines (ifstream &inStream);

int main()
{
string input, output;
cin >> input >> output;

ifstream inStream(input);
ofstream outStream(output);

if(inStream.fail())
cout << "Input file does not exist.\n" ;
else
{
removeSpace(inStream, outStream);
cout << "Text with no white space is successfully written to outFileName.\n";
inStream.clear();
inStream.seekg(0, inStream.beg);

cout << "Number of characters is: " << countChar(inStream) << endl;
inStream.clear();
inStream.seekg(0, inStream.beg);

cout << "Number of words is: " << countWords(inStream) << endl;
inStream.clear();
inStream.seekg(0, inStream.beg);

cout << "Number of lines is: " << countLines(inStream) << endl;
inStream.close();
}

outStream.close();

return 0;
}

//define your functions here

In: Computer Science

Write a working C++ program to ask the user for a set of grades which are...

Write a working C++ program to ask the user for a set of grades which are to be stored in an array in increasing sequence. The user must first provide the number which represents the count of all grades to be provided. For example, if there will be 10 grades, the user is first prompted to provide the number 10. Subsequently, each grade is provided, one at a time. Allow for a maximum of 30 grades in defining the array. When all the grades have been sorted properly, print them all, along with the average.

Process the array using a function which is invoked from the main body of the program. The main body asks for the count of grades and then invokes the grade sequencing function.

You must write in proper C++ syntax and actually execute the program to ensure it works properly.

In: Computer Science

For this exercise, you will receive two string inputs, which are the names of the text...

For this exercise, you will receive two string inputs, which are the names of the text files. You need to check if the input file exists. If input file doesn't exist, print out "Input file does not exist."

You are required to create 4 functions:

void removeSpace (ifstream &inStream, ofstream &outStream): removes white space from a text file and write to a new file. If write is successful, print out "Text with no white space is successfully written to outFileName."

int countChar (ifstream &inStream): returns number of character in input file.

int countWord(ifstream &inStream): returns number of words in input file.

int countLines(ifstream &inStream): returns number of lines in input file.

After calling each function, you have to reset the state flags and move the stream pointer to beginning of file. You can do that by closing and re-opening the file, or by calling member functions:

inStream.clear(); inStream.seekg(0);

Example:

Input: input.txt output.txt

Output:

Text with no white space is successfully written to output.txt.

Number of characters is: 154

Number of words is: 36

Number of lines is: 10

In: Computer Science

Create a C# console application (do not create a .NET CORE project) and name the project....

Create a C# console application (do not create a .NET CORE project) and name the project. Generate two random integers, each between 1 and 50, that you will be adding together to test the user's ability to perform the addition operator. Display the numbers in the console, such as:

            7 + 22 = ?

Once the user provides their answer, check to see if it is correct and if not, tell them sorry, please try again. If their answer is correct, congratulate them on getting the right answer.

In: Computer Science

Python Write a program that loops, prompting the user for their full name, their exam result...

Python

Write a program that loops, prompting the user for their full name, their exam result (an integer between 1 and 100), and then writes that data out to file called ‘customers.txt’. The program should check inputs for validity according to the following rules:

  • First and last names must use only alphabetical characters. No spaces, hyphens or special characters. Names must be less than 20 characters long.
  • Exam result (an integer between 1 and 100 inclusive)

The file should record each customers information on a single line and the output file should have the following appearance.

Nurke Fred 58

Cranium Richard 97

Write a second program that opens the ‘customers.txt’ file for reading and then reads each record, splitting it into its component fields and checking each field for validity.

The rules for validity are as in your first program, with the addition of a rule that specifies that each record must contain exactly 3 fields.

Your program should print out each valid record it reads.

The program should be able to raise an exception on invalid input, print out an error message with the line and what the error was, and continue running properly on the next line(s).

In: Computer Science