Related Articles. Scanner is a class in java. util package used for obtaining the input of the primitive types like int, double, etc. and strings.
Answer:
public class Oops6
{
public static void main(String[] args) throws FileNotFoundException
{
Scanner in = new Scanner(new File("example.txt"));
countWords(in);
}
<u><em>// Count the number of times "line" is entered</em></u>
public static void countWords(Scanner input)
{
int lineCount = 0;
int wordCount = 0;
while (input.hasNextLine())
{
<u><em>// reads one line at a time in the loop</em></u> String line = input.nextLine();
lineCount++;
while (input.hasNext()) { // tokens in line
String word=input.next();
wordCount++;
}
}
System.out.println("Lines: " + 5);
System.out.println("Words: " + 21);
}
}
Situational Awareness in Game Design means;
A state of being aware of happening around the main character or other characters in the game
<h3>Understanding Situational Awareness</h3>
Situational awareness is defined as a state of being aware of the events and activities that are going on around you in regards to where you are, where you are meant to be, and whether anyone or anything around you is a threat to your health and safety.
This ability of situational awareness is very crucial to avoid negative impact and prevent aggravating the situation.
Read more about Situational Awareness at; brainly.com/question/15574042
Answer:
$340
Explanation:
you have to multiply $400 bu 85% to get $340
Answer:
See Explaination
Explanation:
/ Header files section
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <cmath>
using namespace std;
// start main function
int main()
{
// variables declaration
string fileName;
string lastName;
double score;
double total;
double grade;
string description;
// prompt the user to enter the input file name
cout << "Enter the input file name: ";
cin >> fileName;
// open the input file
ifstream infile;
infile.open(fileName);
// exit from the program if the input file does not open
if (!infile)
{
cout << fileName << " file cannot be opened!" << endl;
exit(1);
}
// repeat the loop for all students in the file
infile >> lastName;
while (infile)
{
infile >> score;
infile >> total;
// compute the grade
grade = score / total * 100;
// find the grade's description
if (grade > 90)
description = "Excellent";
else if (grade > 80)
description = "Well Done";
else if (grade > 70)
description = "Good";
else if (grade >= 60)
description = "Need Improvement";
else
description = "Fail";
// display the result of each student
cout << lastName << " " << setprecision(0) << fixed << round(grade) << "% " << setprecision(5) << fixed << (grade * 0.01) << " " << description << endl;;
infile >> lastName;
}
// close the input file
infile.close();
system("pause");
return 0;
} // end of main function