1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Svetradugi [14.3K]
4 years ago
5

Write a class definition of a class named 'Value' with the following: a constructor accepting a single integer parameter a const

ructor with no parameters a method 'setVal' that accepts a single parameter, a boolean method, 'wasModified' that returns true if setVal was ever called for the object. a method 'getVal' that returns an integer value as follows: if setVal has ever been called, it getVal returns the last value passed to setVal. Otherwise if the "single int parameter" constructor was used to create the object, getVal returns the value passed to that constructor. Otherwise getVal returns 0.
Computers and Technology
1 answer:
Amanda [17]4 years ago
7 0

Answer:

The answer to this question can be given as:

Class definition:

public class Value  //define class.

{

private boolean modified = false;   //define the boolean variable and assign value.

private int y;   // define integer variable.

public Value(int x)  //define parameterized constructor

{

y = x;  //holding value in variable y.

}

public Value()  //define default constructor.

{

}

public int getVal()  //define function getVal.

{

return y;  //return value.  

}

public void setVal(int x) //define function setVal.

{

y = x;  //hold parameter value.  

modified = true;   .//hold boolean value.

}

public boolean wasModified() //define function wasModified.  

{

return modified;   //return value.

}

}

Explanation:

In the above class definition firstly we define a class that is "Value". In this class we constructor,methods and variables that can be described as:

  • In the class we define a variable that is modified and y both variable is private but the modified variable is boolean type that is used for hold only true or false value and variable y is an integer variable.
  • Then we define constructors. In this class, we define parameterized constructor and default constructor. In the default constructor, we do write anything but in the parameterized constructor we use the private variable y for the hold parameter value.
  • Then we define a function getVal() and setVal(). The getVal() function is used to return private variable (y) value and setVal() function is used to set the value of y. and we also change the modified variable value that is "True".
  • At the last we define a wasModified() function. In this function, we return the modified variable value.
You might be interested in
Have y’all enjoyed The new hero floryn from Mobile legends
Angelina_Jolie [31]

Answer:

yo! but I'm a ex-mobile legends

5 0
3 years ago
Task 2
USPshnik [31]
4.
3.
1.
5.
2.
I rearranged them so the program would make sense by arranging the interaction in a logical order then placing input statements in between
6 0
2 years ago
Read 2 more answers
Computer Networks - Queues
lyudmila [28]

Answer:

the average arrival rate \lambda in units of packets/second is 15.24 kbps

the average number of packets w waiting to be serviced in the buffer is 762 bits

Explanation:

Given that:

A single channel with a capacity of 64 kbps.

Average packet waiting time T_w in the buffer = 0.05 second

Average number of packets in residence = 1 packet

Average packet length r = 1000 bits

What are the average arrival rate \lambda in units of packets/second and the average number of packets w waiting to be serviced in the buffer?

The Conservation of Time and Messages ;

E(R) = E(W) + ρ

r = w + ρ

Using Little law ;

r = λ × T_r

w =  λ × T_w

r /  λ = w / λ  +  ρ / λ

T_r =T_w + 1 / μ

T_r = T_w +T_s

where ;

ρ = utilisation fraction of time facility

r = mean number of item in the system waiting to be served

w = mean number of packet waiting to be served

λ = mean number of arrival per second

T_r =mean time an item spent in the system

T_w = mean waiting time

μ = traffic intensity

T_s = mean service time for each arrival

the average arrival rate \lambda in units of packets/second; we have the following.

First let's determine the serving time T_s

the serving time T_s  = \dfrac{1000}{64*1000}

= 0.015625

now; the mean time an item spent in the system T_r = T_w +T_s

where;

T_w = 0.05    (i.e the average packet waiting time)

T_s = 0.015625

T_r =  0.05 + 0.015625

T_r =  0.065625

However; the  mean number of arrival per second λ is;

r = λ × T_r

λ = r /  T_r

λ = 1000 / 0.065625

λ = 15238.09524 bps

λ ≅ 15.24 kbps

Thus;  the average arrival rate \lambda in units of packets/second is 15.24 kbps

b) Determine the average number of packets w waiting to be serviced in the buffer.

mean number of packets  w waiting to be served is calculated using the formula

w =  λ × T_w

where;

T_w = 0.05

w = 15238.09524 × 0.05

w = 761.904762

w ≅ 762 bits

Thus; the average number of packets w waiting to be serviced in the buffer is 762 bits

4 0
3 years ago
Kyle is running out of disk space on his hard drive on a Windows XP Professional system. He has installed and configured a third
Varvara68 [4.7K]

Answer:

The answer is "Disk utility".

Explanation:

It'll work well go over to Disk utility before updating the drivers like diskmgmt.msc throughout the Running box, or right-click Device icon, and pick Manage. Click Rescan Disks on the key decision-makers. It's not essential to reconnect until the machine recognizes the latest disc.

  • In each disc setup as storage properties is a reactive drive. Almost every dynamic disk is separated into quantities.
  • It is the season, spanned, and strip volume forms will be included.
5 0
3 years ago
Read 2 more answers
Do you think that people accept poor quality in information technology projects and products in exchange for faster innovation?
ohaa [14]

Answer:

Explanation:

Great question, it is always good to ask away and get rid of any doubts that you may be having.

This depends on the company, but some companies will accept poor quality as long as the product works and provides them faster innovation. This will happen especially if a company knows or has an idea that a competitor is working on a similar product.

Another big reason why a company might accept poor quality in order to release a product is <u>money</u>. Sometimes a company does not have the budget to continue the project, therefore they release it usually in <u><em>Early Access</em></u>. This allows them to start making some money on the project while they continue to work on it.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

5 0
4 years ago
Other questions:
  • Does a BIOS reset erase data such as pictures, programs or other things like that?
    13·1 answer
  • How do you record yourself on a macbook pro
    9·1 answer
  • The term ____ describes primary storage devices that are implemented as microchips, can read and write with equal speed, and can
    8·1 answer
  • Julie is trying to decide weather or not to add a color scheme to her presentation and she asks you for your advice u should adv
    9·1 answer
  • Select the correct answer.
    10·1 answer
  • What is the value of 8n when n= = 2?​
    13·1 answer
  • PLS I NEED HELP Question 6<br> 1 pts<br> What is NOT a built-in function in python?
    5·1 answer
  • The way a student prepares for a test or reviews academic material is referred to as
    8·2 answers
  • Write 2 paragraphs. 1 comparing Shrek the movie and Shrek the musical and another contrasting them.
    12·2 answers
  • Raw materials have two basic types what are the 2?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!