Really, really easy but need help

This question is very easy but I just began java and I need help. I need to write a simple program to display an invoice with item name, number, quantity, and price. I am going to use two classes but I can't figure out how to create instances to make the items display. Can anyone help?

here you go, hope the following code helps
public class InvoiceTest
     public static void main(String[] args)
          Invoice in = new Invoice("375ml fanta", 1234, 10, 1.5);
          System.out.println(in.toString());
public class Invoice
     private String itemName;
     private int itemNumber;
     private int quantity;
     private double price;
     private double totalPrice;
     public Invoice(String name, int num, int qua, double price)
          itemName = name;
          itemNumber = num;
          quantity = qua;
          this.price = price;
     public String getItemName()
          return itemName;
     public int getItemNumber()
          return itemNumber;
     public int getQuantity()
          return quantity;
     public double getPrice()
          return price;
     public double getTotalPrice()
          totalPrice = (double)(price * quantity);
          return totalPrice;
     public String toString()
          return "invoice detail: \n"
                 + "item name: " + getItemName() + "\n"
                 + "item number: " + getItemNumber() + "\n"
                 + "quantity: " + getQuantity() + "\n"
                 + "price:" + getPrice() + "\n"
                 + "total price: " + getTotalPrice();
}

Similar Messages

  • Really dumb question but need help anyway

    I was trying to move an audio book from Downloads to a flash drive. When I looked on the white box icon on the desktop it opened showing the whole
    desktop and everything on it. When I looked on the side of the Finder, the flash drive was not there. When I selected all on the flash drive and hit
    delete, everything on the actual desktop was gone. Command Z. When I dragged the icon to the trash, the flash drive did not shut off.
    This takes real talent on my part, drat it. Help!
    Message was edited by: cam812

    Please close topic. Im sorry for wasted post. Forgot about utilities folder.

  • I am new to this but need help. Lion and iCloud have never worked on my desk top or MacBook Pro.  Slow or Stop!  Is there any way to fix the problem?

    I am new to this but need help. Lion and iCloud have never worked on my desk top or MacBook Pro.  Slow or Stop!  Is there any way to fix the problem?

    We need more information. I'm not sure what you mean by both Lion and iCloud have never worked.

  • HT201269 I'm not a tech person, but need help with my Itunes account in transferring money and downloads onto new phone I purchased 2 weeks ago when my Iphone was stolen. I don't know how to get the money or music on new phone?

    Need help with Itunes transferrs and can I use my Edge phone as a router?

    I'm not a tech person, but need help with my Itunes account in transferring money and downloads onto new phone
    Is this an iPhone?
    Set it up using the AppleID you used on the previous iPhone.

  • I am un able to send mail as it gets stuck in my outbox. I am sure the solution is simple but need help?

    I am un able to send mail as it gets stuck in my outbox. This is a recent phenomena. I am sure the solution is simple but need help?

    I looked everywhere for a solution - and I finally figured it out! Deleting my accounts didn't work, but here is what worked. This worked when my Gmail accounts were not sending properly. I'm not sure if it works for other e-mail services.
    1. While in Mac Mail, click "Mail" in the top left corner of the screen
    2. Click "Preferences"
    3. Click "Accounts"
    4. Select your account that isn't sending properly
    5. In "Outgoing Mail Server (SMTP)" there will be two options - Gmail & Gmail (offline)
    Make sure that "Gmail" is selected and NOT "Gmail (offline)"
    If you navigate to another section in Preferences, it will ask you to SAVE - make sure you save your changes!
    It worked for me, hope it works for you!

  • Ok so I have a free standing iSight Cam, is it possible to use it with my white MacBook ? and if so how do I go about it ? I've tried researching for updates, drives but need help.

    Ok so I have a free standing iSight Cam, is it possible to use it with my white MacBook ? and if so how do I go about it ? I've tried researching for updates, drives but need help. Can someone give me some direction ?

    jpatricio787 wrote: ... is it possible to use it with my white MacBook ?...
    OK so yes, but if, and only if:
    (1) your MacBook has a Firewire port (not all do)
        - and -
    (2) your old external iSight camera works (not all do)
        - and -
    (3) your MacBook is working properly.
    If you are not certain whether your MacBook model has Firewire, you can search MacBook Technical Specifications for your model.  Alternatively, check the  User Guide Manual that came with your MacBook for the information you need to be certain.
    If you are not certain that your old external iSight camera works, you can test it using the suggestions in this link.
    jpatricio787 wrote: ... if so how do I go about it ? ...
    Follow the instructions in your iSight User's Guide to connect and turn on the iSight.  Then launch the Apple app you want to use with your iSight.  If you need more information about using an app, search for "camera" (without the quote marks) in the Help menu choice for the app.
    jpatricio787 wrote:... Can someone give me some direction ?
    If you need more direction, post back the specifics of what you still need.  We will offer further direction based on the details of your reply.
    Message was edited by: EZ Jim
    Mac OSX 10.9.3

  • Purchasing MBA but need help on upgrades.

    Hello, I am purchasing an MBA, but need help on upgrades based on the following; I will be attending medical school in the fall, I take a wide range of photos of my family on my iPhone that I play with on certain apps and do store them in the cloud and computer, I have a medium iTunes libaray but will get bigger with the additional apps for school, I am a moderate gamer (I play games online as well as my kids do, but nothing that will take up a ton of space when downloaded like Assassins Creed) and I plan on running MS Office. I've already decided to upgrade to the 8GB but I can't decide if I should upgrade to the 512GB Flash or stay with the 256GB and upgrade from the i5 to i7 or stick with it. I don't plan on buying another until I graduate. I am new to the Mac World outside of the use of my iPhone which convience me to convert from my awful PC. Can you MBA experts relay some advice on a good route. I appreciate it, Thanks

    My rule of thumb is to buy the largest drive storage available. Especially since the Air models can't be upgraded to a larger size in the future. I also like to buy the most amount of RAM offer and as with the storage space on the Air models can't be upgraded once purchased. So Bite the Bullet and spend the money to get both the most RAM and the largest storage offered as neither can be increased later on.  Also I suggest you spend the extra money on the Applecare extended warranty because to fix any Mac once the standard warranty is over is very expensive. You have until the one year standard warranty runs out to buy the Applecare extended warranty.

  • All of my photos are displayed as BW because somehow I've saved a quick develop preset and it saves as BW.  This is for all of my photos.  I can individually undo them but need help in how to get rid of the preset so it goes to Default. thanks

    All of my photos are displayed as BW because somehow I've saved a quick develop preset and it saves as BW.  This is for all of my photos.  I can individually undo them but need help in how to get rid of the preset so all photos goes to Default or as shot. thanks

    Go to the develop module and highlight all of the images in the filmstrip at the bottom of the screen. Then activate Auto-sync and click on the Reset button. That should reset all of the images to your camera default settings.

  • HT5538 I dont really get this i need help setting some things up on my Ipod.Can you help?

    I need help setting up my Imessage and FaceTime.I have tryed and its not working.

    iOS: Using FaceTime
    iOS: About Messages
    iOS: Troubleshooting FaceTime and iMessage activation
    iOS: Troubleshooting Messages
    iOS: Troubleshooting FaceTime

  • Not a programming problem! but need help

    last week my teacher taught us some addition and subtraction of binary, decimal, hex and octal number. and it's quite easy. but the last topic for me seems to be hard. MULTIPLY AND DIVISION of number system.
    can anybody point me out to some text or link in the web pertaining to this subject
    please!!

    Here is one page: http://www.cut-the-knot.com/blue/SysTable.shtml
    The idea is basically the same as in base 10 (you do know long multiplication and division?), only need to use the multiplication and addition tables of the correct base...

  • Getting a new iMac - overwhelmed w info here but need help

    Hi,
    I'm getting a new iMac next week and need help with Blackberry Bold 9000 issues and syncing with iCal, etc on the machine.  I have been told that I can buy an app for about $30 that will sync the BB with the mac programs but reading here, I am confused - are some of the posts here and the KB notes related to syncing directly with the mac software or are they only for making a separate BB desktop for the mac?
    I have looked at several of the KB notes but I haven't found the answer yet.
    thanks.
    marcelcat
    Bold 9000 owner since Feb 2009

    What’s the difference between:
    8GB 1066MHz DDR3 SDRAM - 4x2GB http://Add $200.00...
    (from 4GB 1066MHz DDR3 SDRAM - 2x2GB)
    and
    8GB 1066MHz DDR3 SDRAM - 2x4GB http://Add $600.00
    4GB DIMMs are at present significantly more expensive than 2GB DIMMs. It's your choice whether to pay the extra money and have empty slots available for additional future memory expansion (without removing any existing memory).
    I presume 2.8GHz Quad-Core Intel i7 is bigger, or more powerful than the 3.33GHz Intel Core 2 Duo of the 21.5” iMac model. Correct?
    Generally yes. You can see benchmarks on places like Barefeats if you want to see comparison numbers.
    it appears the CD/DVD problem thing is not evident in the 27” model as it at least was in the 21.5” model. Right?
    I can't add anything to what I said on the subject previously.
    cracked screens upon opening the box of the new computer, were much more of a problem for the bigger, 27” models that the 21.5” models. Hopefully, Apple has taken care of that by packaging them more carefully.
    I haven't seen a report of any cracked screens in several weeks now. But with the gorillas the shipping companies tend to use, there are no guarantees. I once received a pallet-load of computers that the trucking company had driven a forklift blade through. So you never know how your computer might arrive. The prevalence of problems seems to have been alleviated, though.
    Regards.

  • K330 Motherboard replaced but need help.

    I got the motherboard replaced from the recall.  But the problem is the tech did not put in the Model # and serial on the motherboard.  Is there any motherboard manuals that might tell me if the specs have been upgraded etc??
    From CPU-Z:
    DMI BIOS  
     vendor   LENOVO
     version   DKKT20AUS
     date   03/16/2011
    DMI System Information  
     manufacturer  LENOVO
     product   INVALID
     version   Lenovo Product
     serial   INVALID
     UUID   {FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF}
    DMI Baseboard  
     vendor   LENOVO
     model   To be filled by O.E.M.
     revision  To be filled by O.E.M.
     serial   INVALID
    DMI System Enclosure  
     manufacturer  To Be Filled By O.E.M.
     chassis type  Desktop
     chassis serial  INVALID
    DMI Processor  
     manufacturer  Intel
     model   Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
     clock speed  3400.0 MHz
     FSB speed  100.0 MHz
     multiplier  34.0x
    DMI Port Connector  
     designation  J1A1 (internal)
     designation  PS2Mouse (external)
     port type  Mouse Port
     connector  PS/2
    DMI Port Connector  
     designation  J1A1 (internal)
     designation  Keyboard (external)
     port type  Keyboard Port
     connector  PS/2
    DMI Port Connector  
     designation  J2A1 (internal)
     designation  TV Out (external)
     connector  Mini Centronics Type-14
    DMI Port Connector  
     designation  J2A2A (internal)
     designation  COM A (external)
     port type  Serial Port 16550A
     connector  DB-9 male
    DMI Port Connector  
     designation  J2A2B (internal)
     designation  Video (external)
     port type  Video Port
     connector  DB-15 female
    DMI Port Connector  
     designation  J3A1 (internal)
     designation  USB1 (external)
     port type  USB
     connector  Access Bus (USB)
    DMI Port Connector  
     designation  J3A1 (internal)
     designation  USB2 (external)
     port type  USB
     connector  Access Bus (USB)
    DMI Port Connector  
     designation  J3A1 (internal)
     designation  USB3 (external)
     port type  USB
     connector  Access Bus (USB)
    DMI Port Connector  
     designation  J9A1 - TPM HDR (internal)
    DMI Port Connector  
     designation  J9C1 - PCIE DOCKING CONN (internal)
    DMI Port Connector  
     designation  J2B3 - CPU FAN (internal)
    DMI Port Connector  
     designation  J6C2 - EXT HDMI (internal)
    DMI Port Connector  
     designation  J3C1 - GMCH FAN (internal)
    DMI Port Connector  
     designation  J1D1 - ITP (internal)
    DMI Port Connector  
     designation  J9E2 - MDC INTPSR (internal)
    DMI Port Connector  
     designation  J9E4 - MDC INTPSR (internal)
    DMI Port Connector  
     designation  J9E3 - LPC HOT DOCKING (internal)
    DMI Port Connector  
     designation  J9E1 - SCAN MATRIX (internal)
    DMI Port Connector  
     designation  J9G1 - LPC SIDE BAND (internal)
    DMI Port Connector  
     designation  J8F1 - UNIFIED (internal)
    DMI Port Connector  
     designation  J6F1 - LVDS (internal)
    DMI Port Connector  
     designation  J2F1 - LAI FAN (internal)
    DMI Port Connector  
     designation  J2G1 - GFX VID (internal)
    DMI Port Connector  
     designation  J1G6 - AC JACK (internal)
    DMI Extension Slot  
     designation  J6B2
     type   A5
     populated  yes
    DMI Extension Slot  
     designation  J6B1
     type   A5
     populated  no
    DMI Extension Slot  
     designation  J6D1
     type   A5
     populated  no
    DMI Extension Slot  
     designation  J7B1
     type   A5
     populated  no
    DMI Extension Slot  
     designation  J8B4
     type   A5
     populated  no
    DMI OEM Strings  
     string[0]  DK20A 
    DMI Physical Memory Array  
     location  Motherboard
     usage   System Memory
     correction  None
     max capacity  32768 MBytes
     max# of devices  4
    DMI Memory Device  
     designation  A1_DIMM0
     format   DIMM
     type   unknown
     total width  64 bits
     data width  64 bits
     size   4096 MBytes
    DMI Memory Device  
     designation  A1_DIMM1
     format   DIMM
     type   unknown
     total width  64 bits
     data width  64 bits
     size   4096 MBytes
    DMI Memory Device  
     designation  A1_DIMM2
     format   DIMM
     type   unknown
     total width  64 bits
     data width  64 bits
    DMI Memory Device  
     designation  A1_DIMM3
     format   DIMM
     type   unknown
     total width  64 bits
     data width  64 bits
     size   4096 MBytes

    hey skimore,
    i would suggest to cross reference with your current setup with this >>
    http://www.lenovo.com/psref/pdf/icbook.pdf
    WW Social Media
    Important Note: If you need help, post your question in the forum, and include your system type, model number and OS. Do not post your serial number.
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"!
    Follow @LenovoForums on Twitter!
    Have you checked out the Community Knowledgebase yet?!
    How to send a private message? --> Check out this article.

  • Getting an ipod but need help

    so i will travel to another state and i will be with my aunt that doesnt have a computer and of course no internet. so i wanted to know if there is any place where i can tranfer music to it. like an apple store? please i need help

    It would probably be best to find a family friend who can give you some time on their computer but here's some additional advice. By default the iPod is set to "automatically manage songs and playlists", and it links to a specific computer to update. To use it on multiple computers you need to change the update method to to "manually manage songs and playlists":
    Using iPod with Multiple computers
    Managing Your Songs Manually
    Here are some other useful links if you are new to iPods:
    iTunes Fast Start: New User's Guide to iTunes
    iPod 101
    iPod Higher Learning

  • I need a Rich Text Editor so I'm making one but need help.

    Hi all,
    I'm still figuring out the TLF and how it works so my question might seem dumb to some but any help would be great.
    I'm making a RTE because I need access to a TextFlow when the user is done editing the text. It wasn't obviouse that the halo RTE could do that so I'm making my own.
    The problem I'm running in to is that a user can select a range of text and apply something like italics to it. But if they don't have a range selected, say for example they just want to start off typing in italics, then how would I do that?
    I've tried doing this and it works for a range but not anything else
    var textfmt:TextLayoutFormat = rte.getFormatOfRange(null, rte.selectionAnchorPosition, rte.selectionActivePosition);
    textfmt.fontStyle = (textfmt.fontStyle == FontPosture.ITALIC) ? FontPosture.NORMAL : FontPosture.ITALIC;
    rte.setFormatOfRange(textfmt, rte.selectionAnchorPosition, rte.selectionActivePosition);
    I also tried this when there wasn't a range selected and it also didn't work
    var f:TextLayoutFormat = new TextLayoutFormat();
    f.fontStyle = FontPosture.ITALIC;
    IEditManager(rte.textFlow.interactionManager).applyContainerFormat(f);
    Any help would be great.
    Thanks.

    Never mind, I did the following and things worked for me.
    if (rte.textFlow && rte.textFlow.interactionManager is IEditManager)
               var f:TextLayoutFormat = new TextLayoutFormat();
               f.fontStyle = (italics.selected) ? FontPosture.ITALIC : FontPosture.NORMAL;
               IEditManager(rte.textFlow.interactionManager).applyFormat(f, null, f, null);                       
    If you want to add anything or explain anything I would appreciate that.

  • I want to try elements 11.  Can you talk to me about the free trials.  I downloaded apps., but need help. Thanks

    Hi,
    I spent the better part of this morning finding Adobe/Photoshop elements 11 tutorials.  I wanted to try changing faces on group pictures.  I downloaded what I thought would work.  Now I need help finding out if this "elements 11" is included with what I downloaded so that I may try to use this feature.  Please talk to me about this.  

    First of all, this is the Photoshop forum, not the Photoshop Elements forum:
    Photoshop Elements
    Second, the version currently available from Adobe is Photoshop Elements 12.
    What did you download, and where did you download it from?

Maybe you are looking for

  • Procedure is taking more than 25 hours for execution

    Hi, The below procedure is taking more tahn 25 hours for execution. The Table CA.CR_L_D is having around 15 crores records. Please suggest me the valuable tips to reduce the the execution time CREATE OR REPLACE PROCEDURE NM.L_de_pro IS Type W_Bk_1 Is

  • Print/Design Software on Mac

    Hey I just bought a new MacBook as in yesterday. I'm also a newbie (Mac user that is). I used Microsoft Publisher A LOT on my PC, is there any compatible print/design software for a Mac (besides Adobe InDesign)? or Can I install MS Publisher using Bo

  • Oracle VM 3.0.1 - VNC Console Problem

    I have Oracle VM 3.0.1 enviroment running, Oracle VM Manager 3.0 and several servers running Oracle VM Server 3.0.1. Before, I used Oracle VM Manager 2.2.0 and Oracle VM Server 2.2.2 on the same hardware. Of course, I wanted to use my previous virtua

  • Exception : importing java classes

    Hi all, I'm trying to import java classes in forms 9i, but it generates me this error : Import de la classe prj.proxy.MyWebService1SoapHttpPortClient... Exception : java.lang.NoClassDefFoundError: oracle/webservices/transport/ClientTransport Please g

  • Disappointed on Quicktime 10.0

    I installed the new snow leopard with quicktime 10 and thought that it would play files with extension .mts and .m2ts, but was really disappointed with I saw that it couldn't recognizes the files with these extension. I wonder if anyone knows if quic