Using your choice of pseudocode, C# or java, define a class for a Pig. A Pig object should have three attributes: a name, an age, and weight. Your class should have (i) a constructor that takes three arguments and copies them to the attributes; (ii) setters (mutators) and getter accessors) or properties (C#) for the attributes; (iii) a display method to display the Pig's attributes on screen; and (iv) a main() method that creates a Pig object, assigns values to its attributes, and displays them by calling the display method.

Answers

Answer 1
Answer:

Answer:

Following are the code to this question:

public class Pig //Defining class Pig

{

private String name; //Defining string variable name

private int age; // Defining integer variable age

private double weight; // Defining double variable weight

Pig (String name, int age, double weight)  //Defining parameterized constructor  

{

super(); //using super key

this.name = name; //holding value in name variable

this.age = age;  // holding value in age variable

this.weight = weight; // holding value in weight variable

}

String getName() //Defining method getName

{

return name; //return name value

}

void setName(String name) // Defining method setName    

{

this.name = name; //hold name value

}

int getAge() // Defining method getAge

{

return age; //return value

}

void setAge(int age) // Defining method setAge  

{

this.age = age; // hold age value

}

double getWeight()  //Defining method getWeight

{

return weight; //return weight value

}

void setWeight(double weight) //Defining method setWeight  

{

this.weight = weight; //hold weight value

}

void display() //Defining method display

{

System.out.println("Name:" + name + " Age:" + age + " Weight:" + weight); //print value

}

public static void main(String[] ar) //Defining main method

{

Pig onc = new Pig("Jig",5,14.5); //creating class object and called parameterized constructor  

onc.display();//calling display method

}

}

Output:

please find the attachment.

Explanation:

In the given java program, a class "Pig" is declared, in which three name, age, and weight is defined which differs in datatypes, in the next step, parameterized constructor, get and set method, and display method declared, which can be described as follows:

  • In the parameterized constructor, uses super and this keyword to call and holds parameter value.  
  • In the get method three methods "getName, getAge, and getWeight" are defined, that return method values, and the set method "setName, setAge, and setWeight" uses this keyword to hold value in its variables.
  • The display method is used to print all method store values by its variables name.
  • Inside the main method, class object "onc" is created, which stores the value in it and calls the display method that print value with a message.

Related Questions

As sensory input ________, our ability to detect changes in input or intensity ________.
An analyst receives an alert from the SIEM showing an IP address that does not belong to the assigned network can be seen sending packets to the wrong gateway. Which of the following network devices is misconfigured and which of the following should be done to remediate the issue? A. Firewall; implement an ACL on the interface B. Router; place the correct subnet on the interface C. Switch; modify the access port to trunk port D. Proxy; add the correct transparent interface
Is spread spectrum transmission done for security reasons in commercial WLANs?
Translate each statement into a logical expression. Then negate the expression by adding a negation operation to the beginning of the expression. Apply De Morgan's law until each negation operation applies directly to a predicate and then translate the logical expression back into English.Sample question: Some patient was given the placebo and the medication.∃x (P(x) ∧ D(x))Negation: ¬∃x (P(x) ∧ D(x))Applying De Morgan's law: ∀x (¬P(x) ∨ ¬D(x))English: Every patient was either not given the placebo or not given the medication (or both).(a) Every patient was given the medication.(b) Every patient was given the medication or the placebo or both.(c) There is a patient who took the medication and had migraines.(d) Every patient who took the placebo had migraines. (Hint: you will need to apply the conditional identity, p → q ≡ ¬p ∨ q.)
No Browsing History While using the browser on your tablet, you realize that it is not keeping a history of websites you have visited. Why might this be happening, and what is the first step you will take to correct this problem? Phishing Scam You just received an email message from someone requesting personal identification information. Believing the message was legitimate, you provided the requested information to the original sender. You now realize, however, that you might have fallen victim to a phishing scam. What are your next steps? Suspicious File Attachment You receive an email message that appears to be from someone you know. When you try to open the attachment, nothing happens. You attempt to open the attachment two more times without any success. Several minutes later your computer is running slower and you are having trouble running apps. What might be wrong? Antivirus Software Outdated After starting your computer and signing in to the operating system, a message is displayed stating that your virus definitions are out of date and need to be updated. What are your next steps? Laptop's Physical Security You plan to start taking your laptop to school so that you can record notes in class. You want to make sure, however, that your computer is safe if you ever step away from it for a brief period of time. What steps can you take to ensure the physical security of your laptop?

g Write a line of code to invoke a function named RandNum, which accepts no parameters, and storing the return value in a variable called num (which has already been defined). Separate each item with 1 space (except around the parentheses), and end the line with a semi-colon.

Answers

Answer:

public int RandNum();

* Assuming it returns an integer

Explanation:

I believe you mean to write the function header of randNum.

To write the header of the function, we need to specify its return type, name, parenthesis and parameters inside the parenthesis - if exist.

If it returns an integer it should have int, if it returns a double it should have double in the header. In the answer, I assumed it returns an integer.

The name is already given, RandNum

Since, the function does not take any parameter, inside of the parenthesis will be empty.

Python code 100 Random Numbers (twice)python code

instructions:
You need to write code that will print two bricks of numbers, one with integers, one with decimals.

Answers

import random

i = 1

while i <= 100:

   print("#"+str(i)+": "+str(random.randint(1,100)), end=", ")

   i+=1

print()

i = 1

while i <= 100:

   print("#"+str(i)+": "+str(random.uniform(1,100)), end=", ")

   i += 1

I hope this helps!

Poor quality lateral communication will result in which ofthefollowing?
a. Lack of direction
b. Lack of coordination
c. Lack of delegation
d. Lack of control

Answers

Answer:

b. Lack of coordination

Explanation:

LAteral communication in human resources and organizational communication is known as the communication that exists between peers and colleagues, so that wouldn cause a lack of cirection, delegation or control because its not between bosses and employees, what it would cause would be a lack of coordination between the employees.

Answer:

b

Explanation:

b, lack of coordination

Which exercise can help you prevent Carpel Tunnel Syndrome?make a fist, hold, and stretch your fingers

bend slightly and stretch your right hand up

move your head back and forward slowly

blink your eyes often

Answers

Make a Fist, hold, and stretch your fingers is the correct answer
A. make a fist, hold, and stretch your fingers

C And D are rather absurd as Carpal Tunnel Syndrome is 
caused by a pinched nerve in the wrist.

The two ways to use the help menu is by searching of the contents or searching the _____ Menu
Index
File
Catalog

Answers

The two ways to use the help menu is by searching of the contents or searching the index.

Which of the following are key corporate assets?A) intellectual property, core competencies, and financial and human assetsB) production technologies and business processes for sales, marketing, and financeC) knowledge and the firm's tangible assets, such as goods or servicesD) time and knowledge

Answers

Answer:

A) intellectual property, core competencies, and financial and human assets                                

Explanation:

Key corporate assets are

Intellectual property

Core competencies

Financial and human assets.

Corporate assets are referred to as individuals, properties, goods, data  company or firm repute.These assets are managed digitally. A digital firm is the one in which almost all the important business partnerships and relationships that an organization has with their employees, customers are administered, interposed and handles digitally.

Intellectual property:

It is a property that is the outcome of human creativity and intelligence. It is an intangible property such as copyrights, patents, trademarks etc. The IP strategy is basically a strategy, in accordance with the company's business objectives, to obtain IP assets and extract the most benefit from current IP assets.

Core Competencies:

Core competencies are the skills and proficiency that are essential for a company or business to attain competitive edge. They separate an organization from its competitors and create a competitive lead for a it in the marketplace. Core competency is an corporation's tactical and strategic strength. Development of core competencies of an corporation helps to sustain the competitive advantage of the corporation for a long time.

Financial and human assets.

Basically, the individuals in a corporate determine and define a corporate's success or failure. Human assets are a part of the company's intangible assets. For example human capital is an intangible asset. It can be defined as economic benefit of a worker's experience and skills. For example assets like knowledge, training, intellect, expertise, health. The abilities of employees reflects corporate's assets.

Financial assets refer to a security contract that contains a right over the real assets of a company. For example cash, stocks, bonds and bank deposits. A financial asset has a claim on the real assets or physical assets usually possessed by a company. Financial assets 'main contribution is to finance companies or money making organizations. These are provided in the market so that investors can bring their investments to use, and corporations can invest in real assets and make money.