Printing with print() and table making

[code
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class CarLoan {
public static double p(double d, double i, double t) {
return (d * (i / 12) * Math.pow( (1+(i/12)), t)) / (Math.pow((1+(i/12)), t) - 1);
//computes balance b(m) at m months for simple interest loan
// of d and annual interest i term of t months
public static double b(double m, double d, double i, double t) {
return (d * Math.pow((1+(i/12)), m)) - p(d,i,t) * (Math.pow((1+(i/12)), m) -1) / (i/12);
public static double f(double m, double d, double i, double t) {
return d - p(d,i,t) * m + c(m,d,i,t) * (m * (2 * t - m + 1) / (t * (t +1)));
public static double c(double m, double d, double i, double t) {
return d - p(d,i,t) * (m -1) + b(m,d,i,t);
public static void main(String[] args) {
System.out.println("Car Loan Calculator");
Scanner stdin = new Scanner(System.in);
System.out.println("Enter your amount to finance:");
double d = stdin.nextDouble();
System.out.println("Enter your annual interest rate (in decimals,ie 0.07 is 7%): ");
double i = stdin.nextDouble();
System.out.println("Enter your term (in months): ");
double t = stdin.nextDouble();
System.out.println();
for(double m = 0;m <= t; m++) {
double balanceSimple = b(m,d,i,t);
double balancePrecomp = f(m,d,i,t);
double monthlyPayment = p(d,i,t);
double totalInterest = c(m,d,i,t);
System.out.printf("%4d %4f\n",m , balanceSimple);
//Enter totals in this line here
//System.out.println("Totals " +
Can someone help me print a table with printf() ? Or if you know another way to do it or HOW to do it, that'd help, thanks

No need to: there are no formatting possibilities
available using a PrintStream.
There's just a bunch of overloaded methods for all
the primitives and the
print[ln](Object arg) method simply uses the
toString() method on
the object argument ...
OTOH I don't like the printf() method much
either ... I know what hoops the
C version has to go through to get the job done. IMHO
it doesn't justify the
utility value in Java; but that's just me ;-)Thanks for the input.
kind regards,And to you.
Jos� {�                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • Pdf files print with horizontal and vertical lines

    All of a sudden, today, when I print pdf files, they print with horizontal and vertical lines.  I thaught it was the computer or printer. So I printed from another computer on the network, and printed to a different printer with the same result.  It is not just that one pdf file either, I have tried multiple files.  HELP.  Does anyone have any ideas?

    It is not clear how you are creating the files. It appears that they were created by Distiller from PS files that were created in some way. I also noted that you are using AA8.1.0. You may want to try to update (do all the updates in order) as a possible fix. It may be in the creation process also. Several packages will split large graphics into parts and create the image. I think this is a characteristic of OFFICE 2007 (docx) files - but I am not sure yet. Tell us how you created the files - step by step, including the scan.
    If you have the original documents, why not simply print to the Adobe PDF printer. The result would be smaller and a lot cleaner.

  • SQLJ calling PL/SQL with records and tables as parameters

    Has anyone used sqlj to to call procedures with records and
    tables as IN, OUT, or INOUT as parameters? If so how do you
    assign values to the IN parameter in the record/tables, and get
    values out of the record/table when it is passed back? Might
    anyone have any syntax?
    null

    One thing I forgot to mention: If you're an 8i client, then in
    8.1.6 you'll be able to use JPublisher to solve this problem,
    since it'll generate these wrappers for you.
    Pierre
    Oracle Product Development Team wrote:
    : Hi,
    : The key issue is that no part of Oracle code except PL/SQL is
    : aware of the PL/SQL Record types and PL/SQL "index-by" table
    : types.
    : So the only way to call a PL/SQL procedure with args of a
    RECORD
    : or "index-by" table types is from another PL/SQL routine.
    : In most cases, it's possible to work-around this by wrappering
    : your PL/SQL method with another which doesn't have this issue.
    : For example, if you're trying to call procedure proc01 in:
    : package pack01 is
    : type rec01 is record(n1 number, d1 date);
    : procedure proc01 (r rec01);
    : end;
    : you can create a wrapper method:
    : package pack01_wrapper is
    : procedure proc01_wrapper (n1 number, d1 date);
    : end;
    : package body pack01_wrapper is
    : procedure proc01_wrapper (n1 number, d1 date) is
    : r pack01.rec01;
    : begin
    : r.n1 := n1;
    : r.d1 := d1;
    : pack01.proc01;
    : end;
    : end;
    : If you're a 7.3 client, that's about all you can do. The Fix
    was
    : introduced in 8.0, where new structured types (ADT's) and new
    : table types (VARRAY's and Nested tables) were introduced. So
    if
    : you're an 8.0 client, your 'wrapper' package could use an ADT
    : which has the same attributes as the record, rather than
    : 'exploding' the record into its individual components as I
    showed
    : above.
    : Hope this helps!
    : Pierre
    : Thomas Richardson (guest) wrote:
    : : Has anyone used sqlj to to call procedures with records and
    : : tables as IN, OUT, or INOUT as parameters? If so how do you
    : : assign values to the IN parameter in the record/tables, and
    get
    : : values out of the record/table when it is passed back? Might
    : : anyone have any syntax?
    : Oracle Technology Network
    : http://technet.oracle.com
    Oracle Technology Network
    http://technet.oracle.com
    null

  • Tarantella native client don`t printing with printer usb

    tarantella native client don`t printing with printer usb

    agreed with Wai on upgrading. The first test should be outside of SGD . . . does UNIX print to that USB printer? If not then chances are Tarantella 3.30 will not. If you upgrade to 4.31 you will need to first upgrade to 3.42 then to 4.20 before upgrading to 4.31. Under 4.31 we support PDF printing from UNIX servers. With PDF printing you should have no problem printing to a USB printer.

  • Printing with Aperture and HP B9100

    I am new to Aperture. I just purchased the new 24" iMac and have installed Aperture and a new HP B9100 Pro Printer. I have been making test prints directly from Aperture with photos taken on a Nikon D80. None of the prints have come out anywhere near close to how good things look on my monitor. The prints are darker and lack the vividness and detail I see on my screen.
    I got better prints from iPhoto and my Canon MP780.
    Any suggestions? I apologize for being so green about this stuff.
    Thanks.
    Roger
    24" iMac   Mac OS X (10.4.8)  
    24" iMac   Mac OS X (10.4.8)  

    I have the HP D7160 (uses six inks). I had the same problem, until I spent countless hours testing different parameters.
    I had problems with Aperture printing too muddy/dark until I did the following:
    On an HP Photosmart D7160:
    In Aperture, I have the "system management" as my Color Sync preference. Printer gamma set to 1.25 Black comp "on"
    In my printer dialog, there is a dropdown menu when you select "print". Under the printer presets, I select "Paper type/quality". In this dropdown, there is a selection for Paper: Color:- I select "Color Sync" (not the printer selected "ColorSmart/RGB")
    I also go to the "Color Options" tab and decrease my magenta output to -5.
    I saved this as a "HP D7160" preset, so whenever I print, it automatically changes these for me.
    Works like a charm now, after a lot of trial and error.

  • Share printer with XP and Vista

    I have an HP psc 2110xi connected to a PC running XP. This PC is connected (hardwired) to a Linksys wireless router. Another PC running Vista is connected to the wireless network. I am trying to share the printer with the Vista PC. Is this possible??????I fear it is not but await confirmation from any guru willing to commit him/her self.........

    hello,
    yes, it is possible since your host computer is the XP. make sure the firewall is turned off. try to ping the computer first with each other to make sure that the computers are communicating well with each other.
    go to printers and faxes
    right click on the printer driver and click Sharing.
    put a check mark on Share this printer.
    take note of the share name.
    then from your vista computer type \\ xp ip address.
    for example, \\192.168.1.100
    the printers and faxes window of the XP will show up.
    right click on the driver and click Connect.
    try to print.
    keep me informed please..

  • Pin names and numbers do not print with black and white printer setup option

    Multisim V12
    Printer HP LaserJet 1320
    File -> Print Options -> Print Sheet Setup, check In black/white, OK
    Then
    File ->  Print Preview, shows all elements of the drawing in black white
    Then  select Print and the drawing prints without pin names and pin numbers.
    The same procedure with the black/white unchecked previews in color and then prints all circuit elements

    Hi HiZTrace,
    I used Multisim 12 with the same configuration and printed with a HP LaserJet 4250, but it seemed to be working well for me. There could be some incompatibility issue with your printer driver. A workaround you can try is to install a PDF Converter and print the file in color, then print the generated PDF file in black and white. There are many PDF Converters available, for example, CutePDF Writer (free)
    Sorry for the inconvenience.
    Derek Z.
    National Instruments

  • HP 6940 suddenly printing with lines and red hue

    Hello,
    I was printing photos tonight with my 6940 and suddenly the photos started coming out with the first half (left sides) printed correctly, and the right half has a red hue and striated lines.  I thought the black cartridge might be out, so I replaced it and the photos are coming out the same.  I've just replaced the color cartridge a few weeks ago, so it is not empty.  Any suggestions?
    I tried printing 5 photos, and all came out the same way - left side is printed correctly, right side is ruined.
    Right-click here and choose "Save As" to download a high res photo of the photos as they are coming out of the printer.
    -Gina

    Hi CrazySaguaro,
    It appears as if your colour cartridge is out of ink. If this is the case you should be able to see this in your ink gauge through the driver tool box.
    Here is steps how to check this
    http://h10025.www1.hp.com/ewfrf/wc/document?docname=c00575972&lc=en&cc=us&dlc=&product=467980
    it is located approx half way down the page
    Please let me know what you find out.
    Although I am an HP employee, I am speaking for myself and not for HP

  • Problem to print with iPhoto and epson stylus photo RX620

    I asked a question about the print with Iphoto. Larry gave some explainations but it still doesn't work. I can change the reglages with Safari, with Mail but not with Iphoto. So when I try to print photos, the reglage is standard and the result is bad. I would like to change the reglage, if i use glassy photo paper. With my PC, I have no problem to print with window or picassa. Thanks for your answer.

    First I have no idea in the world what "reglage" is
    But what ever printer specific options are available are supplied by the manafacturer's print driver and these are available on the last print window
    LN

  • Trouble Printing with CS4 and Epson

    I wish to print a 13x19 photo on my Epson Photo Stylus R3000.  After entering all the info correctly with paper size, type, quality, etc I get a print with a one inch blank border on the top and bottom.  I called Epson and they said it was not their problem, it must be something with Adobe.  I am using Photoshop CS4 and Windows 7.  Help, please.  Doro

    So, I found this little piece of info on Epson's site, the question doesn't quite match our problem, but the answer (you would think) would fix us...
    Q: I don’t see my printer driver on the Epson Macintosh Snow Leopard Support page. Where can I find a Mac OS 10.6.x driver for my product?
    A: Try the following:
    Rosetta needs to be installed in Snow Leopard. If necessary, install Rosetta.
    Go to Drivers & Support, select your product category, then select your product name.
    Select Drivers & Downloads, then select Macintosh Operating Systems from the drop-down list and click Go.
    Download the Macintosh 10.5.x drivers for your product.
    Note: If there are no Macintosh OS X 10.5.x drivers available for your product, download and install the Macintosh OS X 10.4.x drivers and the Common Updater software for your product.
    Follow the on screen instructions to finish the driver installation.
    I followed the instructions to the letter.... no results, I still don't see the driver in the drop-down list of available Printer Drivers!

  • Printing with Book and paint()

    I'm posting this because I'm hoping someone can unconfuse me!
    I'm trying to use a Book class, so the correct number of pages appears in the printer dialogue. However, I don't seem to be able to get this to work. My confusion is over the following. In http://java.sun.com/j2se/1.3/docs/guide/2d/spec/j2d-print.fm4.html (section 7.4.2) it has an example with the following three lines:
    Book bk = new Book();
    bk.append(new PaintCover(), pfl);
    bk.append(new PaintContent(), job.defaultPage(), 2);
    and it states this is used to print two pages. Yet the API states the third parameter 'Appends numPages pages to the end of this Book.' This would imply three pages are printed, one of PaintCover and two of PaintContent.
    Furthermore, there is the pgnum parameter in the print() method. Now I would have thought that is tied in with this third Book parameter. But that seems to have a life of its own. It is supposed to be a zero-based index. But does that mean that PaintContent.print() will initially receive the value 1 (ie page 2), and be called twice (because of the argument 2) in the code extract above?
    If so, do you need to have the Printable.NO_SUCH_PAGE return value in the method?
    Perhaps my question should be: how do the third parameters of the Book class and paint() methods work, and how do they relate to each other.
    As I say I am very badly confused, and any advice, help or otherwise prodding in the correct direction will be welcomed! :-)
    Joe.

    Printable.NO_SUCH_PAGE is usefull when u r not using Book ..
    ex, if you use
    book = new Book();
    book.append(this,pageFormat,10);
    printJob.setPageable(book); it will print 10 pages
    and
    printJob.setPrintable(this,pageFormat); will print until you call Printable.NO_SUCH_PAGE - which is usefull when you dont know number of pages

  • Printing With XP And Airport

    I installed Bonjour For Windows and my Epson printer was recognized and made the default printer. It seems that everything is set up right, but it just doesn't print. No errors or anything like that reported. It works OK in OSX.
    I have a MacBook Pro and use Airport and my printer is hooked to that via USB.
    Everything else in Bootcamp with Windows XP works fine, just this problem.
    Is there something else I should do?
    Thanks a lot for your help.

    For those others who might be having the same problem, I found this: The printer you're trying to use with Windows needs to have a name of 15 characters or less.
    http://docs.info.apple.com/article.html?artnum=306514
    When I renamed my default printer "EPSON" in the printer and fax control panel, down from "Epson Stylus CX9400Fax Series" which is the name of the driver and was put in by the Printer Wizard, it gave me a new Printer Wizard window. I just selected the driver and everything works well. Then I just deleted the old printer icons from the printer and fax control panel. End of problem.

  • Printing with SL and Epson 7600

    Would be very interested in hearing from anyone who has installed SL and printed with the Epson 7600... I still use this fossil everyday and don't want to upgrade until I'm sure there won't be issues.

    So, I found this little piece of info on Epson's site, the question doesn't quite match our problem, but the answer (you would think) would fix us...
    Q: I don’t see my printer driver on the Epson Macintosh Snow Leopard Support page. Where can I find a Mac OS 10.6.x driver for my product?
    A: Try the following:
    Rosetta needs to be installed in Snow Leopard. If necessary, install Rosetta.
    Go to Drivers & Support, select your product category, then select your product name.
    Select Drivers & Downloads, then select Macintosh Operating Systems from the drop-down list and click Go.
    Download the Macintosh 10.5.x drivers for your product.
    Note: If there are no Macintosh OS X 10.5.x drivers available for your product, download and install the Macintosh OS X 10.4.x drivers and the Common Updater software for your product.
    Follow the on screen instructions to finish the driver installation.
    I followed the instructions to the letter.... no results, I still don't see the driver in the drop-down list of available Printer Drivers!

  • Using printer with cellphone and ipad

    Do I need my printer hooked to a computer or can I just use it for my iPad and cell phone (Samsung galaxy 5). My desk top computer took a dive but I want to use printer for pics on my cell and ipad

    Hello , Welcome to the HP Forums, and thanks for posting! I understand you are trying to use your HP Photosmart Plus All-in-One printer with your iPad and Android phone. I'd love to help you with this. Was the printer connected wirelessly when you were using it with your computer? If it is still connected to your Wireless network, then you'll be able to print from your mobile devices. On the Android, search for HP ePrint in your Play Store and download it. (Note: the phone will need to have the Wifi turned on and connected to the same network as the printer). On the iPad, open your app store and search for the HP ePrint app. Both devices should be able to work using the same app. Hope this helps!

  • Having problems wirelessly printer with Airport and my Epson CX400

    I recently bought an Airport Express and an Epson CX400. The printer works fine plugged in via USB to my computer but it doesn't work when plugged into my Airport Express. The odd thing is that my computer recognizes the printer in Print & Fax, however in the Epson Print Utility it doesn't and when I go to print a page I get the error, "printer is offline." I've tried re-installing the drivers and just about everything Apple suggested. I Googled the issue and I didn't find anything helpful or up-to-date. Has anyone had this problem and found a solution? A response would be greatly appreciated.
    Message was edited by: David

    I have the same problem with an Epson CX9400Fax. My printer setting says Location: Base Station eb8bbb. I've done all the updates I can find, talked to the friendly people at my local computer store. No help there. I just upgraded this computer from OS X 10.3 to 10.5.6. The printer worked wirelessly then. I have another iBookG4 that prints wirelessly just fine. So, what's up? Turtle

  • Printing with print report.vi

    I am using windows 2000, LabVIEW run time engine and am having problems with printing. When one users logs onto windows, runs the program he is able to print the results. However if someone else logs onto windows they are unable to print. I am just using the report generation vi's that come with LabVIEW. The print report .vi is programmed to use the default printer. Has anyone else had similar problems?

    I have never heard of this myself, although I have heard of general issues with print report.vi. You say that your VI prints fine when "one user logs onto windows." Then it has problems with "someone else logs onto windows." What exactly does happen? Does an error occur? Does it not print at all? Let me know when you get a chance.
    J.R. Allen

Maybe you are looking for

  • I want to use the screen on my touchsmart as a monitor on a new PC.

     I just bought a new gaming tower and i would like to know if i could hook it up to my touchsmart as a monitor.

  • Payroll results could not  be imported

    Hi, We are facing a problem while posting payroll results to FI/CO... Error is " Payroll results could not be imported ".. Kindly help its real urgent hr_user

  • Field Selection Group for Batch Management

    Hi All, I do not want to make the field mandatory for Raw Material during creation of material master. I checked the fileld selection group for MARA-XCHPF for ROH material type, MM01 , it is optional. But when i try to create the Material Master for

  • Why am I getting an ichat error message?

    I have had my fantastic brand new black macbook for 2 days, and have been receiving random error messages on ichat. I used to get this message on my old mac when i tried to transfer a file, and then send a message before it was done transferring. How

  • Illustrator CS6 is not listed in the Programs panel.

    Hi, my Illustrator CS6 is not listed in the Programs panel in the Extensions Manager. How do I restore it? A bit of history: I had been using ScriptBay with Illustrator CS6 before, without problems. After my someone came and resolve some of my comput