Java问题 - 我真的很困惑 [英] Java Question - i am REALLY confused

查看:74
本文介绍了Java问题 - 我真的很困惑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我正在密歇根州的Java课程中学习,但我完全陷入其中一个实验室。


以下是实验室要求的内容 -


创建一个名为'Employee'的类,其中包含三条信息作为实例变量 - 名字(类型字符串),姓氏(类型字符串)和月薪(双)。您的类应该有一个初始化三个实例变量的构造函数。为每个实例变量提供set和get方法。如果每月的slaary不具有代表性,请将其设置为0.0。编写一个名为EmployeeTest的测试应用程序,演示类Employee的能力。创建两个Employee对象并显示每个对象的年薪。然后给每位员工10%的加薪,并再次显示每位员工的年薪。


我在此停滞不前。


如果你不能给我'答案',你可以为我分解一下吗?我不太清楚如何开始这个....


提前多谢SOOO

解决方案


大家好,


我正在密歇根州的Java课程中学习,但我完全陷入其中一个实验室。


以下是实验室要求的内容 -


创建一个名为员工的类,其中包含三条信息作为实例variaveles - 名字(String类型),姓氏(String)和月薪(double)。您的类应该有一个初始化三个实例变量的构造函数。为每个实例变量提供set和get方法。如果每月的slaary不具有代表性,请将其设置为0.0。编写一个名为EmployeeTest的测试应用程序,演示类Employee的能力。创建两个Employee对象并显示每个对象的年薪。然后给每位员工10%的加薪,并再次显示每位员工的年薪。


我在此停滞不前。


如果你不能给我'答案',你可以为我分解一下吗?我不太确定如何开始这个....


非常感谢SOOO预付



从员工开始按你的问题指定并写下它。


我真的很难过


所以这两个单独的代码是什么? [我正在使用NetBeans IDE]


基于你的回复---这是我得到的,没有重新混淆自己:)


公共级员工{


公共员工(){

}


}


类已启动,但我究竟要做什么来创建实例变量[我可以获得任何示例代码或真正打破这个问题的东西吗? - 我觉得一文不值:)]


i想要理解这一点 - 因为我知道它会弹回来......但是在类中如何定义所有这些实例变量,并设置提出方法?



我真的很难过


这两个单独的代码是这样的吗? [我正在使用NetBeans IDE]


基于你的回复---这是我得到的,没有重新混淆自己:)


公共级员工{


公共员工(){

}


}


类已启动,但我究竟要做什么来创建实例变量[我可以获得任何示例代码或真正打破这个问题的东西吗? - 我觉得一文不值:)]


i想要理解这一点 - 因为我知道它会弹回来......但是在类中如何定义所有这些实例变量,并设置并获得提出的方法?



阅读这个。


Hi all,

I am taking a Java Course in Michigan to get into the flow of things , but i am completely stuck on one of the Labs.

Here is what the Lab Asks for -

Create a class called ''Employee'' that includes three pieces of information as instance variaveles -- a first name (type String), a last name (type String) and a monthly salary (double). Your class should have a constructor that initializes the three instance variabvles. Provide a set and a get method for each instance variable. If the monthly slaary is not prositive, set it to 0.0. Write a test application named EmployeeTest that demonstrates class Employee''s capabilitis. Create two Employee objects and display each object''s yearly salary. Then give each Employee a 10% raise and display each Employee''s yearly salary again.

I AM SOOOO LOSTTTT in this.

please if you can''t give me the ''answer'' can you maybe break it down for me? Im not quite sure how to even begin this....

Thanks SOOO much in advance

解决方案

Hi all,

I am taking a Java Course in Michigan to get into the flow of things , but i am completely stuck on one of the Labs.

Here is what the Lab Asks for -

Create a class called ''Employee'' that includes three pieces of information as instance variaveles -- a first name (type String), a last name (type String) and a monthly salary (double). Your class should have a constructor that initializes the three instance variabvles. Provide a set and a get method for each instance variable. If the monthly slaary is not prositive, set it to 0.0. Write a test application named EmployeeTest that demonstrates class Employee''s capabilitis. Create two Employee objects and display each object''s yearly salary. Then give each Employee a 10% raise and display each Employee''s yearly salary again.

I AM SOOOO LOSTTTT in this.

please if you can''t give me the ''answer'' can you maybe break it down for me? Im not quite sure how to even begin this....

Thanks SOOO much in advance

Start with the Employee class and write it as specified by your question.


I''ve really had a tough time

so is this two separate codes? [i am using NetBeans IDE]

based on your response --- this is as far as i got without re-confusing myself :)

public class Employee {


public Employee() {
}

}

Class was started, but what exactly do i do to create the instance variables [could i get any sample code or something that really breaks this down for me? - i feel worthless :) ]

i want to understand this - as i know it will pop back up ...but within the class how are all of these instance variables defined, and set and get methods brought up?


I''ve really had a tough time

so is this two separate codes? [i am using NetBeans IDE]

based on your response --- this is as far as i got without re-confusing myself :)

public class Employee {


public Employee() {
}

}

Class was started, but what exactly do i do to create the instance variables [could i get any sample code or something that really breaks this down for me? - i feel worthless :) ]

i want to understand this - as i know it will pop back up ...but within the class how are all of these instance variables defined, and set and get methods brought up?

Read this.


这篇关于Java问题 - 我真的很困惑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆