Answer:
dataFile << salary;
Explanation:
To write salary to a file (payroll.dat) using ofstream, you make use of the following instruction:
ofstream dataFile;
myfile.open ("payroll.dat");
myfile <<salary;
myfile.close();
This line creates an instance of ofstream
ofstream dataFile;
This line opens the file payroll.dat
myfile.open ("payroll.dat");
This is where the exact instruction in the question is done. This writes the value of salary to payroll.dat
myfile <<salary;
This closes the opened file
myfile.close();
Consider the following class designed to store weather statistics at a particular date and time:
public class WeatherSnapshot
{
private int tempInFahrenheit;
private int humidity; // value of 56 means 56% humidity
private int dewPoint; // in degrees Fahrenheit
private String date; // stores the date as a String
private int time; // in military time, such as 1430 = 2:30 pm
private boolean cloudy; // true if 25% or more of the sky is covered
// constructor not shown, but it initializes all instance variables
// postcondition: returns temperature
public int getTemp()
{
return tempInFahrenheit;
}
// postcondition: returns date
public String getDate()
{
return date;
}
// postcondition: returns true if precipitation is likely; false otherwise
public boolean precipitationLikely()
{
// implementation not shown
}
// other methods not shown
}
Suppose a WeatherSnapshot object named currentWeather has been correctly instantiated in a client class. Which of the following will correctly call the precipitationLikely method?
A. boolean couldRain = precipitationLikely();
B. boolean couldRain = currentWeather.precipitationLikely();
C. boolean couldRain = currentWeather.precipitationLikely(true);
D. double percentChanceOfRain = precipitationLikely();
E. double percentChanceOfRain = currentWeather.precipitationLikely();
Answer:
The answer is "Option b".
Explanation:
In this question, It took the boolean parameter, which may use the couldRain as the precipitationLikely precipitation method as the boolean variable because the precipitationLikely is not a static type, and it can name this method utilizing object is called currentWeather, that's why the choice b is correct.
At Moore High, 456 students attended the prom. This is 65 more students than
the previous year.
To the nearest percent, what is the percent of increase from last year to this
year?
12%
15%
17%
19%
Answer:
B-15%
Explanation: