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...
Type: Posts; User: fahman_khan75@yahoo.com
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...
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...
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...
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...
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);
...
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...
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...
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...
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...
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...
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...
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...
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. ...
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
...
Sweet :D makes much for sense!thank you Cornix!
Glad to hear that since his method just confused me out! Thank you!
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;
...
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...
haha...I should clarified about how to use "files" in classes not how to use the file class :D Appreciate our response though!
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...
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...
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...
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...
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...
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...