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
Create a C# console application (do not create a .NET CORE project) and name the project TuitionIncrease. The college charges a full-time student $12,000 in tuition per semester. It has been announced that there will be a tuition increase by 5% each year for the next 7 years. Your application should display the projected semester tuition amount for the next 7 years in the console window in the following format:
The tuition after year 1 will be $12,600.
Note: The number is in the output and the format of the tuition amount is currency with 0 decimal places
In: Computer Science
Create a C# console application (do not create a .NET CORE project) and name the project TimeToBurn. Running on a particular treadmill, you burn 3.9 calories per minute. Ask the user how many calories they wish to burn in this workout session (this is their goal). Once they tell you, output on the console after each minute, how many calories they have burned (e.g. After 1 minute, you have burned 3.9 calories). Keep outputting the total amount of calories they have burned until they have met their goal.
In: Computer Science
pseudocode The main( ) program passes these integer values as arguments to the findMax( ) method for further processing. The main program receives one result back from findMax( ) method and displays the maximum of these three integer values. The findMax( ) method simply receives three integer values from the main program and finds the maximum of three integers and returns one value back to the caller (in this case the main application).
In: Computer Science
Please complete in C# and use radio buttons on the form for the selections. Thank you!
For this assignment, you will be creating a Dorm and Meal Plan Calculator.
A university has the following dormitories: Allen Hall $1,500 per semester Pike Hall $1,600 per semester Farthing Hall $1,800 per semester University Suites $2,500 per semester The university also offers the following meal plans: 7 meals per week $ 600 per semester 14 meals per week $1,200 per semester Unlimited meals $1,700 per semester Create a multi-form Windows Forms Application with two forms.
The main form should allow the user to select a dormitory and a meal plan. The application should show the total charges on the second form.
In: Computer Science
Compile a 750- to 1,250-word executive summary to be submitted to the executive committee. Within the summary:
In: Computer Science
1. Write CREATE TABLE statements for the following tables (foreign keys are in italic and bold). Make sure you have all needed constraints and appropriate datatypes for attributes:
Student (stID, stName, dateOfBirth, advID, majorName, GPA)
Advisor (advID, advName, specialty)
2. Insert several records in each table.
In: Computer Science
Using JAVA
The following code is able to read integers from a file that is called "start.ppm" onto a 3d array called "startImage".
Implement the code by being able to read from another file (make up any file name) and save the data onto another 3d array lets say you call that array "finalImage".
The purpose of this will be to add both arrays and then get the average
Save the average onto a separte 3darray,lets say you call it "middlearray"
Then add startImage and middlearray and get the average then save it to another array called "fourtharray"
Then add finalImage and middle array and get the average then save it to another array called "fiftharray".
Print all 5 arrays
import java.util.Scanner;
import java.io.*;
public class P1
{
public static void main(String[] args) throws IOException
{
final int ROW=267;
final int COL=400;
File file= new File("start.ppm");
Scanner inputF= new Scanner(file);
int[][][] startImage= new int[ROW][COL][3];
int row=0, col=0;
int line=1;
while (inputF.hasNext())
{
if(line<=4)
{
inputF.nextLine();
line++;
}
else
{
line+=3;
if (col< COL)
{
startImage[row][col][0]=inputF.nextInt();
startImage[row][col][1]=inputF.nextInt();
startImage[row][col][2]=inputF.nextInt();
col++;
}
else
{
row++;
col=0;
startImage[row][col][0]=inputF.nextInt();
startImage[row][col][1]=inputF.nextInt();
startImage[row][col][2]=inputF.nextInt();
col++;
}
}
}
inputF.close();
for(row=0;row {
for(col=0;col {
for(int color=0;color<3;color++)
{
System.out.println(startImage[row][col][color]);
}
}
}
}
}
In: Computer Science
Which is the correct answer a, b, or c
What variables are deallocated by garbage collection?
a. Global Variable
b. Class field
c. Unreachable objects
When should you call garbage collection?
a. After each method
b. After declaring a class
c. You don't call garbage collection
In: Computer Science
Use Boolean algebraic laws to prove the following equivalences:
If you are able to explain some of the thought process behind the problems, that would be amazing. Thanks
In: Computer Science
Create truth tables for the following expressions. Include all necessary negations and sub-expressions.
If you could explain the thought process behind how you did these that would be amazing, I am trying to learn the reasoning as I practice. Thanks
In: Computer Science
We want to design and develop a text statistical analyzer. This analyzer should consider an input text as a finite sequence of characters, including letters (‘a’, .., ‘z’, ‘A’, ..., ‘Z’), digits (0,…, 9), special characters (space and new line), and punctuation characters (‘.’, ‘,’, ‘;’). The input text must end with ‘#’. A word is defined as a sequence of alphanumeric characters (letters and numbers, 0 to 9) delimited by two separators. A separator is any non-alphanumeric character. Use your favorite object-oriented programming language to write a program that accepts a text as input and gives as output the following results: i. The total number of alphanumeric characters (i.e., letters and digits). ii. The total number of letters and their frequency with respect to the total number of alphanumeric characters. 2 iii. The total number of digits and their frequency with respect to the total number of alphanumeric characters. iv. The total number of words. v. The total number of words starting with “ted” and their frequency with respect to the total number of words. vi. The total number of words ending with “ted” and their frequency with respect to the total number of words. vii. The total number of words having “ted” in the middle and their frequency with respect to the total number of words. viii. The total number of sequences of “ted” and their frequency with respect to the total number of sequences of three alphanumeric characters. The implementation of this text statistical analyzer should be as structured as possible.
Write a code for the above problem either in c/c++.
In: Computer Science
Document where I have # to explain what the code is doing. (5 of the 20 points will be for documenting)
Fill in the __ and __________ spaces to complete the code.
Logic
"""
This program approximates the value of pi using an algorithm
designed by the German mathematician Gottfried Leibniz. The
algorithm is as follows:
pi = 4 - 4 / 3 + 4 / 5 - 4 / 7 + . . .
This program allows the user to specify the number of
iterations
to use in the approximation.
"""
#
import __________
#
iterations = __________
pioverfour = ___
numerator = ___
denominator = ___
#
for count in range(__________:
"""equation using varibles""""
numerator = __numerator
denominator __= __
#
print("The approximation of pi is", __________)
print("Compare this to the computer's estimation: ", ________)
In: Computer Science