Search:

Type: Posts; User: fahman_khan75@yahoo.com

Page 1 of 2 1 2

Search: Search took 0.10 seconds.

  1. Formating integers into money

    having the following fields for my money class.
    import java.text.DecimalFormat;
    public class Money
    {
    //Fields for money will hold dollars and cents
    private long dollars;
    private long...
  2. Copying objects through constructors?

    I have a class named Cash shown below
    public class Cash
    {
    //Quanity Field and RetailItem Object field
    private int total_units;
    private Retail myRetail;


    //Create first constructors...
  3. Replies
    4
    Views
    779

    Re: Enum questions

    Lol, I already tried figuring out or else I wouldn't have posted it here, frankly speaking. My guess is that "Monday" is being stored in that variable instead of 1. I'm highly positive of this but is...
  4. Replies
    4
    Views
    779

    Enum questions

    The following code
    enum Days {Sunday, Monday, Tuesday);

    Days workday= day.monday; simple question members, though not for me. What is being stored in the variable workday? Is the value of Monday...
  5. Re: Using this reference variable on constructors

    In my book, it had the code
    public RetailItem(String desc,int itemNumber,
    double wholesale, double retail)
    {

    description=desc;
    ItemNumber=itemNumber;
    cost=new CostData(wholesale, retail);
    ...
  6. Using this reference variable on constructors

    I’m trying to simplify my constructor by using “this” reference variable. I’m aware how to use this reference when making constructors that involve fields of primitive data types; however, not so...
  7. Replies
    2
    Views
    1,078

    Enumerations help

    I have created an enumerated data type that represents months. In my program I have asked the user for the month. I hold the month entered by user into a string variable. From that string variable...
  8. Getting error on equals method for objects

    I'm taking an introduction to java class right now, so please don't advice me to something that I have not learned yet. My assignment is that I have to create a class that has two fields. One called...
  9. Re: Creating objects from methods

    Ok, so I'm reading my java book and this is what it reads . The book also mentions that Either I'm interpreting this wrong, which I believe I am, or I doubt your actually wrong :D since your more...
  10. Replies
    9
    Views
    2,208

    Re: FileDisplay Class

    Your English is fine. Yes that is exactly what I mean. I'm wrong in this part but this is what I'm thinking. In my main code
    public static void main(String...) suppose a variable like int number is...
  11. Re: Creating objects from methods

    I do understand what the error is. Basically the variable is not initialized to any value. From my understanding and from what I have read, when passing objects to methods, the reference variable is...
  12. Re: Creating objects from methods

    Thank your for your response! I'm aware that's not the conventional way of writing a code; however, I was using my ipad during that time. Apologize for my mistake. Also, I did peak on to the links...
  13. Re: Passing Objects to Constuctors

    I take that back. I'm totally confused now, after seeing this writing of code being used in my book. In a hurry right and not so sure if I mentioned that
    .getDescription got used in a constructor. ...
  14. Creating objects from methods

    public class demo
    {
    Public class static void main(String[]args)
    {
    //Creating a variable that will be a reference to the object
    Peoples person_one;

    //create an object using void method
    ...
  15. Replies
    6
    Views
    1,227

    Re: Closing files

    Sweet :D makes much for sense!thank you Cornix!
  16. Re: Passing Objects to Constuctors

    Glad to hear that since his method just confused me out! Thank you!
  17. Passing Objects to Constuctors

    We are learning about how to pass objects into constructors. In our class, we made this following code
    public class InventoryItem
    {
    //fields
    private String description;
    private int units;
    ...
  18. Replies
    6
    Views
    1,227

    Re: Closing files

    Got your point but what I have been reading from my book, it guided me to close all of your ouput and input files when I'm done reading and writing with them...I'm aware that whenever I don't close...
  19. Re: How to open files when in classes instead of the main code.

    haha...I should clarified about how to use "files" in classes not how to use the file class :D Appreciate our response though!
  20. Replies
    9
    Views
    2,208

    Re: FileDisplay Class

    Understood you , but when the
    public class rectangle
    {
    private int length;
    private int width;
    FileReader read;
    }

    This class will only remain within this scope of the class. I do understand...
  21. Replies
    6
    Views
    1,227

    Closing files

    I have opened up an input file using
    File input=new File("hello.txt") Then I have created a scanner object that reads data from the file.
    Scanner read_file=new Scanner (input) my question is when...
  22. Replies
    1
    Views
    795

    PRINTWRITER Class

    I have a few questions relating to I/o files.

    1.) Is FileReader class the same as File Class. In my book it uses File class to read data from a file, but one of the members here used FileReader so...
  23. Replies
    9
    Views
    2,208

    Re: FileDisplay Class

    Thank you for suggestions, once again. Apologize if I'm asking to many questions but I have want to understand it completely rather then being foggy about this topic.

    1.) what's the difference if...
  24. Re: How to open files when in classes instead of the main code.

    Thank you! Did help me a lot and I did read your other post which seemed to help be a lot :) I appreciate it. I know how to write codes using files but couldn't understand how to use files in classes...
  25. Replies
    9
    Views
    2,208

    Re: FileDisplay Class

    I know I have double posts going but I do have different questions now dicdic. And yes I do know that, I was just frustrated not knowing what to do so I wrote down everything quickly here. Apologies...
Results 1 to 25 of 36
Page 1 of 2 1 2