1) How do you read the contents of a text file that contains whitespace
characters
as part of its data?
2) What capability does the fstream data type provide that the ifstream
and ofstream
data types do not?
3) What header file do you need to include in a program that performs
file operations?
4) What data type do you use when you want to create a file stream object
that
can write data to a file?
5) What data type do you use when you want to create a file stream object
that
can read data from a file?
6) Why should a program close a file when it
s finished using it?
7) Write code that does the following:
(a) Opens an output file with the filename Numbers.txt ,
uses a loop to write the numbers 1 through 100 to the file,
and then closes the file.
(b) Opens the Numbers.txt file that was created in Part 7a,
reads all of the numbers from the file and
displays them in rows of 10 values, and then closes the file.
(c) Add all of the numbers read from the file and displays their
total.
In: Computer Science
The use of computers in education is referred to as computer-assisted instruction (CAI). More sophisticated CAI systems monitor the student’s performance over a period of time. The decision to begin a new topic is often based on the student’s success with previous topics. Modify the following auxiliary program (Computers are playing an increasing role in education. Write a program that will help an elementary school student learn multiplication. Use rand to produce two positive one-digit integers. It should then type a question such as: How much is 8 * 9? The student then types the answer. Your program checks the student’s answer. If it is correct, print “Very good!” and then ask another addition question. If the answer is wrong, print “No. Please try again.” and then let the student try the same question again repeatedly until the student finally gets it right. Terminate the program when the student has 5 right answers.) to count the number of correct and incorrect responses typed by the student. After the student types 5 answers, your program should calculate the percentage of correct responses. If the percentage is lower than 75 percent, your program should print “Please ask for extra help” and then terminate. If the percentage is 75 percent or higher, your program should print “Good work!” and then terminate.
I am programming student so please keep code simple enough that I can learn from it thanks
In: Computer Science
Create a program that will loop and prompt to enter the highlighted data items in the structure below. This is every item except customerNumber , isDeleted and newLine;
const int NAME_SIZE = 20;
const int STREET_SIZE = 30;
const int CITY_SIZE = 20;
const int STATE_CODE_SIZE = 3;
struct Customers { long customerNumber; char name[NAME_SIZE]; char streetAddress_1[STREET_SIZE]; char streetAddress_2[STREET_SIZE]; char city[CITY_SIZE]; char state[STATE_CODE_SIZE]; int zipCode;
char isDeleted;
char newLine;
};
Always set the item isDeleted to 'N' and
newline to '\n'. The item newLine
is a convenient item that is there to assist in viewing the
contents of the file using "type filename" the cmd window.
Notepad will show the binary chars and will not line up the data as expected. You may see some odd characters after the expected data for the character arrays. That is normal for C/C++.
The item customerNumber should start at 0 and increase by 1 for every record written.
Once the data in the structure is loaded, write it to the file
"Customers.dat" and prompt to continue. If the reply is to not
continue, close the file and exit.
The file "Customers.dat" must be opened in Binary mode.
1. Modify this program to open the file "Customers.dat" so that all data is written to the end of the file AND to allow the file to be read.
2. Create a method called "getLargestCustomerNumber" and call it after the "Customers.dat" file has been opened. Read all the existing customerNumbers and determine the largest customerNumber - do not assume the last record in the file is the largest number. Use this number as the base when adding new customer data.
3. Display the customer number calculated for the customer number that is receiving input.
4. The program needs to create the Customers.dat file if it does not exist.
5. The program should be able to start multiple times and add data with increasing customerNumbers. There should be no duplicated customer numbers.
In: Computer Science
1. public class MyString { private char[] data; MyString(String string) { data = string.toCharArray(); } public int compareTo(MyString other) { /* code from HW1 here */ } public char charAt(int i) { return data[i]; } public int length() { return data.length; } public int indexOf(char c) { /* code from HW1 here */ } public boolean equals(MyString other) { /* code from HW1 here */ } /* * Change this MyString by removing all occurrences of * the argument character c. For example, if MyString s * represents the text "radar", then s.remove('a') will * change s so that it now represents the text "rdr". */ public void remove(char c) { /* Type in the box below the code that should go here. */ } }
public class ArrayIntSet {
private int[] data;
private int size;
public ArrayIntSet(int capacity) {
data = new int[capacity];
size = 0;
}
2.
public int size() { return size; }
public boolean contains(int i) { /* Code from HW3 here */ }
public boolean addElement(int element) { /* Code from HW3 here */ }
private int index(int element) { /* Code from HW3 here */ }
public boolean removeElement(int element) { /* Code from HW3 here */ }
public boolean equals(ArrayIntSet other) { /* Code from HW3 here */ }
public void union(ArrayIntSet other) { /* Code from HW3 here */ }
public void intersect(ArrayIntSet other) { /* Code from HW3 here */ }
/*
* Returns a new ArrayIntSet that contains
* all the even numbers from this set.
*/
public ArrayIntSet evenSubset() {
/* Write code for this method in the box below */
}
}
In: Computer Science
Look up the 2019 Capital Market Assumptions from Voya. The .pdf document should be titled, "2019 Capital Market Assumptions."
Find their correlation matrix and then find the following correlations:
In: Finance
In 2015, the Keenan Company paid dividends totaling $2,740,000 on net income of $12 million. Note that 2015 was a normal year and that for the past 10 years, earnings have grown at a constant rate of 4%. However, in 2016, earnings are expected to jump to $19.2 million and the firm expects to have profitable investment opportunities of $9.6 million. It is predicted that Keenan will not be able to maintain the 2016 level of earnings growth because the high 2016 earnings level is attributable to an exceptionally profitable new product line introduced that year. After 2016, the company will return to its previous 4% growth rate. Keenan's target capital structure is 40% debt and 60% equity.
Regular-dividend | $ |
Extra dividend | $ |
In: Finance
A common goal of insurance regulators is to ensure availability of property insurance to homeowners residing in urban areas. Concerned that insurers will offer property business only in upscale neighborhoods or urban areas, regulators in State A adopted a regulation requiring insurers to maintain a business presence throughout urban areas. State B adopted a regulation with the same goal as State A; however, State B’s regulation does not exempt any companies and includes a requirement that an executive from each company annually file a certification with the state. The certification must indicate how the company is complying with the regulation and provide evidence that the company is actively soliciting policies throughout the urban areas, with sales initiatives proportionate to population.
In: Operations Management
I don't know why my java code is not running this error code pops up --> Error: Could not find or load main class DieRoll Caused by: java.lang.ClassNotFoundException: DieRoll.
Code below:
import java.util.Random;
import java.util.Scanner;
public class Assignment {
public static void combineStrings() {
String school = "Harvard";
String city = "Boston, MA";
int stringLen;
String upper, changeChar, combine;
stringLen = school.length();
System.out.println(school+" contains "+stringLen+" characters." );
upper = school.toUpperCase();
System.out.println(upper);
changeChar = upper.replace("A", "*");
combine = school +" "+city;
System.out.println("The final string is "+combine );
}
public static void dieRoll()
{
Scanner scanner = new Scanner(System.in);
Random random = new Random();
int sides, n1, n2, n3;
System.out.print("How many sides? ");
sides = scanner.nextInt();
n1 = random.nextInt(sides)+1;
n2 = random.nextInt(sides)+1;
n3 = random.nextInt(sides)+1;
System.out.println("First Roll\t="+n1);
System.out.println("Second Roll\t="+n2);
System.out.println("Third Roll\t="+n3);
System.out.println("Die Total\t="+(n1+n2+n3));
System.out.println("Average Roll\t="+((n1+n2+n3)/3.0));
}
public static void candy()
{
int numCarton=0,candyBars;
Scanner scanner = new Scanner(System.in);
System.out.println("Enter the number of candy bars : ");
candyBars = scanner.nextInt();
do
{
numCarton++;
candyBars = candyBars-24;
}while(candyBars > 0);
System.out.println("Number of Cartons needed = "+numCarton);
}
public static void main(String[] args) {
combineStrings();
dieRoll();
candy();
}
}
In: Computer Science
Design the Class Diagram (UML) for a banking system with its clients’ accounts and an ATM machine. Each client account holds the user’s name (String of Full Name), account number (int) and balance (int). All client account details should be hidden from other classes but the system should provide tools/methods to access, change, and display (toString for account) each of these details.
The ATM machine holds the available money inside it (double) and the maximum money it can hold (double).
A user can request to withdraw, deposit or display balance through their account after checking the possibility of the action based on the ATM machine attributes. The balance display can be directly sent to the ATM. However, the withdraw request needs checking the user’s balance before checking the cash availability in the ATM machine. Also the deposit requires ensuring that the amount of cash will not exceed the maximum of the ATM.
For example, if the machine is full with cash then a user cannot deposit his money and a message should be displayed to the client that the machine is full and money cannot be deposited. In addition, if the machine has lower amount than what the withdraw request requires, the operation will be cancelled with an appropriate message on the standard output.
Use a default constructor (no formal parameters) and a full constructor (all class variables are initialized from formal parameters) for the client account.
object oriented programming "" Eclipse java"
In: Computer Science
New-Project Analysis
The Campbell Company is considering adding a robotic paint sprayer to its production line. The sprayer's base price is $930,000, and it would cost another $24,000 to install it. The machine falls into the MACRS 3-year class, and it would be sold after 3 years for $620,000. The MACRS rates for the first three years are 0.3333, 0.4445, and 0.1481. The machine would require an increase in net working capital (inventory) of $14,500. The sprayer would not change revenues, but it is expected to save the firm $392,000 per year in before-tax operating costs, mainly labor. Campbell's marginal tax rate is 25%. (Ignore the half-year convention for the straight-line method.) Cash outflows, if any, should be indicated by a minus sign. Do not round intermediate calculations. Round your answers to the nearest dollar.
What is the Year-0 net cash flow?
$
What are the net operating cash flows in Years 1, 2, and 3?
Year 1: | $ |
Year 2: | $ |
Year 3: | $ |
What is the additional Year-3 cash flow (i.e, the after-tax salvage and the return of working capital)?
$
If the project's cost of capital is 11%, what is the NPV of the project?
$
In: Finance
Describe and give an example of the following: CyberTerrorism, Hacktivism, Black Hat Hacking, CyberCrime, CyberEspionage, CyberWar.
In: Computer Science
In: Finance
Discuss an important concept from You Are Not So Smart.
Please make sure the answer is at least 250 words. ******250 words each and include a word count. Each question is worth 12.5 points.******
In: Psychology
QUESTION 17
What is the best description of how assets and liabilities of a subsidiary are shown in consolidation, when the acquirer bought stock in steps, occurring over several years?
a. |
They are shown based on the book values on the subsidiary’s books |
|
b. |
They are shown based on fair value as of the latest date stock was acquired, as long as the acquirer has significant influence, adjusted for amortization |
|
c. |
They are shown based on fair value as of the time the acquirer first obtained significant influence, adjusted for amortization |
|
d. |
They are shown based on fair value as of the time the acquirer first obtained control, adjusted for amortization |
In: Accounting
a trapezoidal channel with a fall of 6m per km is required to convey a discharge of 7 m^3/s through terrain consisting of loose soil. perform the following .
A. design a trapezoidal concrete lined ( n = 0.013) channel.
B. design an effective trapezoidal concrete lined with Bermuda grass ( n= 0.035) which has minimum perimeter subject to the low hazard constraint Vy < 0.4m^2/s and v < permissible velocity.
In: Civil Engineering