Problem with printing to a text document

Well to start off...here is my code.
import java.io.*;
import java.util.*;
// Mike Hatch
public class project12
static Scanner console = new Scanner(System.in);
     Scanner inFile = new Scanner(new FileReader("f:\\JAVA\\projects\\receipts.txt"));     
     public static void main(String[] args)
int movies;
          double price;
          price=2.00;
double change, cash, tax, total;
System.out.println("Enter how many movies you are renting.");
movies = console.nextInt();
          System.out.println("movies = " + movies);
          price = movies * 2.00;
          System.out.println("The movie price is " price ".");
          tax = price * .08;
          System.out.println("Tax: " +tax);
          total = price + tax;
          System.out.println("The Total with Tax is " total ".");
          System.out.println("Cash Tendered: ");
          cash = console.nextDouble();
          change = (cash - total);
          System.out.printf("Your change is %.2f", change);
          if (change < 5)
               {System.out.println("Thank You For Doing Buisness With US.");}
               else if (change >=5)
               {System.out.println("Thank You");}
          else if (change >5);
               {System.out.println("We Value Your Buisness Here At The Movie Shop");}
               inFile.close();
This is the error i am recieving:
project12.java:53: non-static variable inFile cannot be referenced from a static context
               inFile.close();
               ^
1 error
does anyone have an idea on how to fix this. i have been trying for quite a while not to no avail.
if anyone can help it would be much appreciated.
-silence-

now im getting the project12.java:71: reached end of file while parsing
^
1 error
i added more code to this though, here is the updated code:
import java.io.*;
import java.util.*;
// Mike Hatch
public class project12
static Scanner console = new Scanner(System.in);
     public static void main(String[] args) throws FileNotFoundException
Scanner inFile = new Scanner(new FileReader("f:\\JAVA\\projects\\receipts.txt"));
int movies;
          double price;
          price=2.00;
double change, cash, tax, total;
System.out.println("Enter how many movies you are renting.");
movies = console.nextInt();
          System.out.println("movies = " + movies);
          price = movies * 2.00;
          System.out.println("The movie price is " price ".");
          tax = price * .08;
          System.out.println("Tax: " +tax);
          total = price + tax;
          System.out.println("The Total with Tax is " total ".");
          System.out.println("Cash Tendered: ");
          cash = console.nextDouble();
          change = (cash - total);
          System.out.printf("Your change is %.2f", change);
          if (change < 5)
               {System.out.println("Thank You For Doing Buisness With US.");}
               else if (change >=5)
               {System.out.println("Thank You");}
          else if (change >5);
               {System.out.println("We Value Your Buisness Here At The Movie Shop");}
movies = inFile.nextInt();
          price =     inFile.nextDouble();
          change = inFile.nextDouble();
          cash = inFile.nextDouble();
          tax = inFile.nextDouble();
          total = inFile.nextDouble();
               inFile.close();
}

Similar Messages

  • I had a problem with print preview of billing document.

    HI all,
    I had a problem with print preview of billing document which contains two output types ZR1 ZR2..
    For the footer text of billing document I maintained the font size as 7,5 pts, But when i go for print preview from output type ZR1 the font size of footer text is very small and looks good for output type ZR2.
    If i change the print options-->logical destination of output type ZR1 same as Output type ZR2, the footer text looks good.
    I think there is some issue with logical destination in print options for the output type ZR1, how can i resolve  it.

    hi,
    for both the output types , r u using same sapscript or smartform?
    if yes then, u can control it in output options of smartform and also in sapscript , you can control through if condition.
    and if differect sapscript or smartform then you should not get such problem.
    you can check the sapscript or smartfrom in TNAPR table.

  • Problem with printing a formatted text

    Hi,I make a program, which creates tests and examines users. At the end of examination I need to print an exam record. Which way is the best to do this, if I need to print a lot of things (time, user records, right answers, wrong answers..........) at fixed position by different fonts?
    I have placed JLabels to one JPanel and I have printed it, but it was not printed correctly. Some JLabels were missing and some were shortened.
    Can someone help me? How is it made in a professional aplications?
    Thank you
    Frantisek Marousek
    [email protected]

    Hi,I make a program, which creates tests and examines users. At the end of examination I need to print an exam record. Which way is the best to do this, if I need to print a lot of things (time, user records, right answers, wrong answers..........) at fixed position by different fonts?
    I have placed JLabels to one JPanel and I have printed it, but it was not printed correctly. Some JLabels were missing and some were shortened.
    Can someone help me? How is it made in a professional aplications?
    Thank you
    Frantisek Marousek
    [email protected]

  • Problem with printing from Acrobat Reader XI

    SInce I installed Acrobat Reader XI I have got problems with printing out pages. The text starts a bit down (2 cm) on the paper, resulting that the last part of the text on the page will be missing. And the missing part does not follow on page 2, it just don´t comes out!
    It doesn´t matter what settings i click in on the print setting page in Acrobat Reader, it always gets the same result.
    Does anyone know what can be the problem?

    No files appeared in C:\Users\Pavilion\AppData\Roaming\Adobe\Adobe PDF\Settings but they did appear in Distiller.
    I tried to copied them from C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\Settings, but found they were already there.  I copied them by adding -COPY before .joboptions in the name.  Now they appeared in  Printing Preferences with the -COPY added.
    I tested a print from Word (using File / Print), but was not prompted for the filename or location.  I checked my entire system and couldn't find the PDF file anywhere.  I tried changing the Port to Desktop\*.pdf using Printer Properties, but that didn't work either.
    I was able to successfully use the Acrobat menu item in Word & Excel to create a PDF but it automatically created the file on the Desktop without an option to change the filename.
    After several days and hours, I gave up and installed Acrobat X on the W7 computer.  I can still use Acrobat XI on the W8 computer.  So be it!
    Thanks anyway for your attempts to help.

  • Problem with printing through SAP

    Hi All,
    We have problem with printing, only one person through SAP can only print the documents successfully and the remaining are getting incomplete print output. This is happening only for transactions GD23 and FB03 (FI related transactions). We have tried with removing Saplpd folder and installing Sprint as suggested by SAP from note 894444. Still problem persists. Please suggest me in this regards.
    Veerendra Kumar.

    Hi Ardhian,
    We are using Front end printing and already installed SAP GUI new version i.e. 7.10.
    Only one user is able to print the document correctly from SAP, and other are getting incorrect print and getting error message "System cannot print the last 80 columns of the report" on one system.
    SAP version we are using is 4.7EE.
    Let me know if any more information needed for analysing the issue.
    VeerendraKumar.
    Edited by: Veerendra Kumar Mutyala on Feb 20, 2009 5:35 AM
    Edited by: Veerendra Kumar Mutyala on Feb 20, 2009 5:37 AM

  • Problems with Print Preview in PO.

    Hi Experts, I need your help!!
    I have problems with print preview in purchase order, if the PO has moviments ( GR or Invoice ) I cant see the form of PO in Print Preview...Anybody has idea about happen?
    I can see the form before i make the movements after i cant see anymore..This is right?
    There is the document explain the problem
    [http://www.easy-share.com/1903543233/PO_PROBLEM1.doc]
    Thanks

    Hi,
    What is the particular error message which prevented you from print preview?  I have not seen such case before in many systems.
    Cheers,
    HT

  • "Problem with printer or ink system"

    Hello, so this morning I printed out a paper and I saw I was almost out of black ink. I replaced the cartridge and everything was okay. When I went to print out another paper I received the error message "Problem with printer or ink system... 0x6100004e" I went to HP support and found a whole bunch of solutions. I went through the first few, there is no paper jams, but then I realized my carriage was either not leaving the dock or it would come all the way left just to go right back. When I open the door, its like the printer thinks the carriage is moving because it keeps turning the way it normally would. I tried resetting it, and looking up other solutions but nothing. My warranty was up in May. It had never had this problem when I changed the cartridges before, so I really need all the help I can get.

    Hi andre2015,
    Please perform the steps from the link below and this will resolve the issue.
    http://support.hp.com/us-en/document/c03253201
    ---- If my answer was helpful please click the Kudos star.
    If your problem is solved please click the Accept as Solution button so other forum users can use the solution.
    Regards
    Aneesh

  • Problem with print photo 13x18

    hi i have a problem with print photo (13x18) size it cut in the end of photo i use hp photo creations but if choose 100%size or full screen  same result  please what can i do;  i am disapoint to buy this printer if photo print so

    Cornelia-I, I used "single/image contact sheet" and there is a Lightroom
    Template for 2x2 cells.  I modified this a little to make the cells smaller
    to provide room for the captions and margins for hole punching and binding
    the sheets.
    No, I surely did not type in each caption.  The captions were Title plus
    Caption taken from the metadata plus a comma and # sign preceding the
    filename which was a date/sequence number.  I was printing four different
    images on each page and 36 images total so there were nine pages of the
    booklet.
    I didn't try the idea of switching the Photo Info option off and back on to
    the custom package because I had already created a custom preset and as soon
    as I discovered that all it needed was to have a period added or removed at
    the end of the line each time, it was easy to simply switch back and forth
    between the two text presets which was doing the same thing you recommended.
    Whole job was simple once I discovered that the problem was simply that I
    needed a new version of the text string every time I printed and couldn't
    simply keep using the same one over and over.  The time wasted was lost
    trying to figure out what was causing the lines to suddenly become truncated
    when previously they had been there.  Which is why I wrote it up so others
    need not waste that time if they want to do this.

  • Many problems with the 'Export to Text' (.txt) in CR Xi

    Hi,
    I have listed many problems with the 'Export to Text' (.txt) function of CR Xi.
    These problems are related to this export format only (meaning everything works fine in the Viewer or in the 'Export to PDF')...
    - Multi-columns layout do not export as Multi-column (export only a one column);
    - Numeric values with parenthesis for negative values or with a fix currency sign at the leftmost position are not exported correctly;
    - Fields having a Suppress formula which is "WhilePrintingRecords" do not appears when exported;
    - Fields with 'Suppress double value' checked are not always suppressed when exported to Text.
    - 'Keep Group Together' flag is not working.
    - 'Reset Page Number After' simply does not works when exported to text;
    - 'Keep object together' on TextBox/Section is not working.
    - Whenever a group is ending on the last line of a page, the the following page as the same Group header as the previous group with no records until the page is filled, then the PageBreak and PageHeader is missing but the records of the following group appears.
    I would like to know what is the status of the 'Export to Text' function (is it a deprecated function not supported anymore???).
    If still supported, when will these bugs be fixed???
    Thanks

    Hi Rene
    Export to Text is supported till date. Crystal Reports 2008 also supports this with Keep together working however when I tried with format with multiple columns, it didnot show up in the exported text file.
    Regards
    Sourashree

  • HP Officejet Pro 8600 "Problem with Printer or Ink System'

    A gander at this forum suggests I am one ofa multitude of people perplexed by this issue. There is a notation beside one enquiry which says 'Problem Solved'.... well it isn't for me. My printer (typical!) is one month out of warranty. I had to replace the black cartridge and, when I did, it came up with this error prompt. I then replaced all the other cartridges. HP suggests removing the printhead and following that they say place it 'upside down on a clean sheet of paper'... NO instructions for cleaning it!! When it is replaced in the printer they suggest you 'rock the printhead left and right to make sure that the printhead fully seats in the carriage' and if THIS doesn't fix things 'try reseating the printhead up to 3 times'... This in itself is an admission of an 'issue' with this product. It doesn't sound like a very scientific engineering 'fix' to me!
    A new printhead costs almost what we paid for the printer a year ago. I hate consigning anything to landfill that I can avoid... unfortunately it looks like that is where this unit belongs...

    Hi @Robin_Perth,
    Welcome to the HP Forums!
    I am sorry to hear about you getting the problem with printer or ink system error, with your HP Officejet 8600, but I am happy to look into this for you!
    I am assuming you have already been through this guide, A 'Problem with Ink System' Error Message Displays on the Control Panel or Computer During Setup.
    If this guide does not resolve the issue, please call our technical support at 800-474-6836. If you live outside the US/Canada Region, please click the link below to get the support number for your region. Country-language selector.
    This guide, Limited Warranty for HP Ink Cartridges and Customer-Replaceable Printheads for HP Inkjet Supplies, will help you to determine if your printhead is still in warranty or not.
    Hope this helps!
    RnRMusicMan
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" to say “Thanks” for helping!

  • HP 4622 All in One Printer: Problem with Printer or Ink System

    Problem with Printer or Ink System Error OXC19a0027.

    charleshia wrote:
    Thanks so much for replying to my post. I tried the fist suggestions and they did not work. So, I attempted to move on Dow to the cleaning of my printer. I am the the first to admit that I'm not the genius when it come to electronics buys, my printer do not seem to have what is described in the photos. I'd like to upload a photo of my ink cartage but do not know how.
    Charleshia, you can upload a photo here to reply. Click Reply, then on the window you'll see the image below..
    click the one which has the red box, it's where you insert the photo
    Going back on your issue.. the basic step would be.. take out the inks then close the door... what error message you  got? If it's saying "Missing Ink Cartridge" just hit OK. Unplug the power cable at back of the printer, plug it back in.. Clean the copper contacts on the ink cartridges using a lint free cloth then reinstall them. Let me know if it resolved it or not.. I can only give basic troubleshooting here

  • Problem with printing a PDF

    Hi All,
    I'm developing a web application written in J2EE that uses Java Reporting Component (JRC) to display crystal reports from some filters recovered from a jsp and passed to a report .rpt previously designed and invoked just at runtime.
    I have a problem with printing a PDF:
    I want, after entering the filters in a jsp, to print a report in PDF format (WORD) without opening it
    with Adobe Reader (Microsoft Word). The class of API JRC used for export is ReportExportControl.
    Can anyone help me?
    I wish a great day to You all.

    Hi Ted Ueda,
    sorry for the delay of my answer.
    I understand very well the problems related to security.
    With the following code that I used to produce a report (PDF) at runtime,
    is the PDF created on the server and then sent to the client, or is it directly created on the client as PDF
    from RTF previously realized?
    ReportExportControl exportControl = new ReportExportControl();
    String report = report path;
    ReportClientDocument reportClientDoc = new ReportClientDocument();
    reportClientDoc.open(report, OpenReportOptions._openAsReadOnly);
    Object reportSource = null;
    reportSource = reportClientDoc.getReportSource();
    //The method setConnectionProperties() stores all the connection parameters in the collection
    //ConnectioInfos
    ConnectionInfos connInfos = setConnectionProperties(request, reportClientDoc);
    exportControl.setEnableLogonPrompt(false);
    exportControl.setEnableParameterPrompt(false);
    exportControl.setReportSource(reportSource);
    exportControl.setDatabaseLogonInfos(connInfos);
    //Single method to pass parameters to Crystal Reports. Using classes ParameterFieldController and
    //ParameterFieldDiscreteValue
    setReportParametersValue(reportClientDoc, reportParameters, subReportParameters);
    ExportOptions exportOptions = new ExportOptions();
    //Set the export format (PDF)
    exportOptions.setExportFormatType(ReportExportFormat.PDF);
    PDFExportFormatOptions PDFExpOpts = new PDFExportFormatOptions();
    exportOptions.setFormatOptions(PDFExpOpts);
    exportControl.setExportOptions(exportOptions);
    exportControl.setExportAsAttachment(true);
    try {
          exportControl.getHtmlContent(request, response, getServletConfig().getServletContext());
    } catch (ReportSDKExceptionBase e) {
    throw new ApplicationException("error code", ": error message"); }               
    As, however, I predicted in my previous message about the direct printing on the client,
    I read about ActiveX, but I don't know how to use them.
    I read this information in the 'Crystal Reports for Eclipse Developer Guide' about "printMode" attribute:
    "In ActiveX print mode, an ActiveX control is downloaded to the client machine and the report is send directly to the printer...."
    The ActiveX alternative is a java applet that runs on the client and takes the pdf from the server and prints directly onto the clients through the commands that I used in the DOS command line:
    1)     AcroRd32.exe /p /h FILENAME
    where
    /p = print
    /h = hide window
    to print the report and
    2)     tkill AcroRd32
    to close Adobe Reader, because it doesn't end automatically after printing and the command  /h  is used just to minimize the process.
    I hope you can give me advice because I need to print directly on the client. Thank you

  • Problem with printing pdf file

    hello,
    lately i have problem with printing pdf file:
    i click on the print button and the respod is very slow
    it takes more than a minute till the print window apears.
    i tryied to install version X but it's the same, the problem exist only when printing via adobe reader,
    other programs i'd working much faster.
    please advice,
    thank you

    No, it is not set to overprint. Also, I have to add that the printing results were not consistent. Sometimes it covered and sometimes it did not.

  • Problem with printing files created by tcpdf class

    Hello,
    I have problem with printing pdf files created with tcpdf php class which contain embedded fonts
    http://www.tecnick.com/pagefiles/tcpdf/example_008.pdf
    Could someone try to print that example file at his Reader (printing to file .ps will be fine).
    I'm trying to determinate if problem is in my system (Ubuntu 8,04) in Reader or in class.
    Thanks in advance

    No problem with Adobe Reader 8 or 9 .

  • Problems with printer and network connectivity

    So I've been using an HP B110a photosmart wireless e-all-in-one printer that I got with my macbook pro and at the start, everything worked perfectly in terms of wireless printing, ePrint, and AirPrint. But recently, when I try to print wirelessly, it says the printer is not connected and I also can't find it on the list of nearby printers on the 'add printer' window. I also had problems with printing via ePrint but those have cleared up (I don't know what was wrong but it's fine now). Printing with AirPrint on my iPod touch has stopped working as well because the printer doesn't show up when I search for nearby printers.
    Here's what I've checked/tried so far:
    All the wireless services are enabled on my printer and my mac
    I've reset the printing system on my mac, printer settings to factory defaults
    Restarted mac/printer/iPod
    Restarted router
    Reinstalled HP printing software that came with the printer
    All software is up to date
    Wireless printing on another windows computer does work
    Setting up wireless printing using the HP install disc doesn't work
    Trying to add a new printer using the HP software disc that came with the printer is unsuccessful in locating the printer as well.
    Printing over USB is problem-free
    When I tried restarting the printer/router, I could see the printer for just a few minutes in the 'add printer' list but then it would disappear from the list and the printer would be 'not connected' so I can't print wirelessly.
    More info
    MacBook Pro (13 inch, early 2011)
    Mac OS X Lion (10.7.2)
    HP Photosmart e-All-in-One B110a
    Router is a Huawei HG556a that I got from Vodafone NZ
    Thanks in advance!

    http://support.apple.com/kb/DL907

Maybe you are looking for