2.20 Domain Lab 3.1 -- Velocity Calculator
You may (or may not) need the following constants:
Velocity Calculator Your program should ask the user (in this order) for:
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 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 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. 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:
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.
. .
. .
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
In: Computer Science
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
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
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
In: Computer Science
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 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
In: Computer Science
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. 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 (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:
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