Done some reworking and got this now
while (inputScanner.hasNextLine())
{
String Name, isCov;
int quantity;
double combinedCost,cost, amountCov, amountDue, pctCovered;
Type: Posts; User: hoobahstank
Done some reworking and got this now
while (inputScanner.hasNextLine())
{
String Name, isCov;
int quantity;
double combinedCost,cost, amountCov, amountDue, pctCovered;
With this code my program goes through the whole file but i still did not the format properly, but how would i add the the 2nd and 3rd i values?
while (inputScanner.hasNextLine())
{...
Is there any other way to do it? Like a more simple way? Only because the professor hasn't mentioned a counter to be needed at all.
Every line is not a number though, it is like every 6th line is a number i need to keep a total of, do i need to make an exception in the loop so that every like 6th line i hold that value?
question, i have to add totals of some numbers in the loop, am i able to do this within a loop or is there like a class or function or something i need to add to code?
So my code is coming along well. Its not the prettiest but it works. Except for formatting the output. Each column is not the same distance away so how can i make it so each output fits under the...
OK back after a couple days, i have simplified my code, this currently works to an extent. My professor today gave us pseudocode on how we should write this program. It went:
Open input file
Open...
This is currently what the output looks like.
Pet Vet Visit Report
Vet: Andrea Rodriguez
Date: Andrea Rodriguez/Andrea Rodriguez/Andrea RodriguezPet Vet Visit Report
Vet: 9
Date: 9/9/9Pet...
Yea i just put in a print statement and it is correctly reading the file, so my issue is with how i can output it nicely.
--- Update ---
This is what i got now, but this prints these 3 lines...
So i can create the printstream outside of the loop but the output also cant be in the loop, so would it go before or after the loop? Since this continually outputs vet: then whatever is read.
...
Hey so i now am outputting into the file but im not getting the data to transfer over. The only output i get is vet: Is this because im printing after the loop reads through the whole file?
...
Found my issue. That line was incorrect on my program i had = new Scanner(fileName) i did not have the new file and extra set of parentheses.
It made no difference. I went back to this code and it just outputs the filename back to me still.
while (inputScanner.hasNextLine())
{
String i = inputScanner.nextLine();...
File name has to be the path? I have just been inputting the name of the file which is in the same folder. Is that wrong?
Nothing. Im startin to think maybe i dont have the file in the correct spot. The file has to be in the folder with all the other code right? I put it in the same folder but unsure if it has to go to...
OK so i switched it up and here is the code. But after i enter the file names it just ends for some reason.
try
{
Scanner inputScanner = new Scanner(new File(fileName));
...
Kinda confused, so i used a wrong kind of scanner?
I made a catch statement and it now runs. But the output is just one line and its the name of the file that i input.
try
{
Scanner inputScanner = new Scanner(fileName);
...
Right, i do not know how to structure the loop file. I have this:
try
{
Scanner inputScanner = new Scanner(fileName);
while (inputScanner.hasNextLine())
That would work yes.
No each line has a single item of data. Either a string or int, it is a set format so i will know when it is a string and when it is a int. Also i know i need to have a scanner to read in the file...
The file contains information from a vet office so it holds like a name then the next line is age and procedure, amount. Theres a whole list i have its about 10 different things. I need to read in...
Need to read in from a file. That file is a list of information like a name then next line can be a number. I need to take that info a output it into a file. So here i have the code to get the two...