Rob Samberg

Greenhorn
+ Follow
since Jan 28, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rob Samberg

Hi Layne,
I might have specific questions if I knew what I was doing. Things are getting really messy now. Please help? I guess if I had one question for this mess, is what should be my main method? And, can you tell me what part of the code belongs in the Product.java editor and what belongs in the ProductTester.java editor.
[code]
public class Product
{

public Product()
{
Product productSale = new Product();
{

{
product.setPrice(29.95);
}
public class Product()
{
newProduct = Product - double amount;
}

{
product.getPrice();

System.out.println(newProduct);

}

}
[code]

Thanks. Sorry about the mess - it's really frustrating. I don't know what I'm doing. I'm starting to freak out.
18 years ago
[code]

public class Product
{
// Sets the price of a product.
public void setPrice(double amount)
{
}

// Gets the price of a product.
public double getPrice()
{
}
[code]
18 years ago
I'm working on it. I'll add some stuff and see what you guys think. Thanks.
18 years ago
Ok - that's great - I'm going to work on that for a while. Thanks. If you can think of anything else that might help, even if it's just general Java stuff for a beginner, I'd appreciate it.
Thanks again.
18 years ago
I did mention I'm brand new to this I hope. Well I am. I really don't know what the heck I'm doing. I'd appreciate anything at all that you think might help!
I don't mind reading and figuring stuff out, but I don't even know where to look.
Thanks,
Rob
[code]
public class Employee
{

public Employee()
{
name = "unknown";
}

public Employee()
{
salary = 0;
}


public class EmployeeTester
{

public EmployeeTester ()
{
name = "Robert Samberg";
salary = 50000;

System.out.println("name" "salary")

public void newSalary(double amount)
{
double newSalary = salary + (salary/20.0);
salary = newSalary;
}
[code]

Can someone tell me what if anything is right with this code?
[ January 28, 2006: Message edited by: Rob Samberg ]
18 years ago
An employee has a name (a string) and salary (a double). I'm supposed to write a default constructor, a constructor with two parameters (name and salary), and methods to return the name and salary. Then I have to write a small program that tests my class.
Please help!!!
18 years ago
Hi, I need help with the code.
I have no I idea where to begin.
All I have is:

public class Product

Here, I'll just write what the assignment says.
Implement a class Product. A product has a name and a price, for example new Product("Toaster" , 29.95). Supply methods getName, getPrice, and setPrice. Write a program that makes twor products, prints the name and price, reduces their prices by $5.00, and then prints them again.

Anyway, that's what it says in the book.
Then my teacher wants me to:
Exercise P3.8 on page-99 of the text. Produce a neat self-explanatory output as
desired by the problem description. When you decrease the price of a product, first
use the getPrice() method to get its price, and then setPrice method to set its
price to a new value.

Organize the two java classes (testProduct and Product) in two different files.

Can you help please? I have no idea where to even begin!
18 years ago
Hi - This is my first semester - I'm taking intro to Java and I'm supposed to write a program that sets a price for a toaster and then another toaster at 5% less and I'm supposed to test it.
Can someone just push me in the right direction please?
18 years ago