Answer:
The code to this question can be given as:
class Sample //define class Sample.
{
//define private member.
private int count;
private String name;
Sample(int count, String name) //define parameterized constructor.
{
this.count = count; //holding values.
this.name = name;
}
public int getCount() //define function with returntype.
{
return count;
}
public String getName() //define function with returntype.
{
return name;
}
public void setCount(int count) //define function with no returntype.
{
this.count = count;
}
public void setName(String name) //define function with no returntype.
{
this.name = name;
}
}
Explanation:
In the above code firstly we define the class that is Sample. In this class, we define two variable that is not public. Then we define the constructor. This code we parameterized constructor because it takes the values as a parameter. To assign the value in the constructor we use this keyword. Then we used the get and set method. when we use get method because it returns a value (getcount and getname). When we use the set method it does not return any value (setcount and setname).
Answer:
C
Explanation:
By providing a new avenue for entrepreneurs
to start their own businesses, the internet influences such ethical issues greatly.
Answer:
The answer to the following code is "40".
Explanation:
In the question there are two variable is given that is discountAmount and orderTotal. In the orderTotal variable, we assign a value that is 200. Then we use the if...else Ladder conditional statement. In this statement, we use the if block in the if block we check condition that if orderTotal variable value is greater then 200. we calculate the 3 percent of orderTotal and put the value in the discountAmount. In the else-if block, we check that if orderTotal variable value is greater then 100. then we calculate the 2 percent of orderTotal that is 40 and put the value in the discountAmount. In the else part we calculate the 1 percent of orderTotal and put the value in the discountAmount. So the answer to this question is "40".