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
Vinil7 [7]
3 years ago
11

#Create a class called Name. Name should have two attributes

Computers and Technology
1 answer:
prisoha [69]3 years ago
3 0

Answer:

//class Name

class Name {

// attributes gave you 3

String first_name;

String last_name;

int length = 0;

//constructor with 2 parameters

Name(String first_name, String last_name){

}

//methods

public String find_printed_name(){

return first_name + " " + last_name;

}

public void find_sortable_name(){

return last_name + ", " first_name.charAt(0);

}

public static void main(String[] args){

// instantiate the class

Name test_name = new Name("David", "Joyner");

System.out.println(test_name.first_name);

System.out.println(test_name.last_name);

System.out.println(test_name.find_printed_name());

System.out.println(test_name.find_sortable_name());

}

Explanation:

You didn't specify a language so I did it in Java.

You should know how to declare methods in Python.

You might be interested in
Create the logic for a game that simulates rolling two dice by generating two random numbers between 1 and 6 inclusive. The play
guajiro [1.7K]

Answer:

The solution code is written in Python 3.

  1. import random  
  2. count = 0
  3. flag = False
  4. guess = int(input("Input your guess (2-12): "))
  5. while(count <=3):
  6.    dice1 = random.randint(1, 7)
  7.    dice2 = random.randint(1, 7)
  8.    if((dice1 + dice2) == guess):
  9.        flag = True
  10.    count += 1
  11.    
  12. if(flag):
  13.    print("User wins!")
  14. else:
  15.    print("Computer wins!")

Explanation:

A Random generator is needed for this question and therefore we start by importing Python random class (Line 1)

Next, create one counter variable,<em> count</em>, to ensure there will be only three rolling of the dices (Line 3).  We need another variable, <em>flag</em>, to track the status if the two dices equal to the <em>guess</em> number chosen by user (Line 4).

Next, prompt use to input a guess number (Line 5).

Within the while loop, we can use random class method <em>randint() to </em>generate random integer. The arguments 1 and 7 will give one random number ranged from 1 to 6 for <em>dice1</em> and<em> dice2</em>, respectively (Line 8 - 9).

If the total of<em> dice1 + dice2</em> equal to user <em>guess</em>, we turn the<em> flag </em>to <em>True</em>. If not, the <em>flag </em>will remain <em>False</em> after completing entire while loop.

If the <em>flag </em>turned to <em>True</em>, print the message "User Wins!" else print the message ("Computer wins!")

8 0
4 years ago
i have a at&amp;t router and a 1000mbs Ethernet cable connecting from that to my net gear r7000 that can push +1000mbs. the cabl
Lady_Fox [76]
DSL ranges from 128Kbps to 3Mbps, so this would be your bottleneck.
7 0
3 years ago
You are a cleared employee. Your friend called and told you that he saw information about the classified XYZ program on the Inte
m_a_m_a [10]

Answer:

Yes, because though you are a cleared employee, the classified information should not be open for all employees to see as it is a data disclosure violation.

Explanation:

Data is a vital tool in the business industry. The need to secure data or present it to be seen by competitors is very crucial as it maintains the dominance of a company on its competitors.

Only authorized employees in a company are allowed to view classified data and must report any siting of data spill, to avoid prosecution.

3 0
3 years ago
236. A system such as a printer, smart TV, or HVAC controller, typically uses an operating system on what is called a:
irakobra [83]

Answer:

Embedded System

5 0
2 years ago
Read 2 more answers
What is the difference between Sleep and Shut Down?
OleMash [197]

Answer:

When you shut down your PC, all your open programs close and the PC shuts down your operating system. but In sleep mode, the PC enters a low-power state. The PC's state is kept in memory, but other parts of the PC are shut down and won't use any power.

Explanation:

3 0
3 years ago
Other questions:
  • 10^4+10-2=<br>10^4+10-2=
    12·2 answers
  • If you want the values in your cell to have dollar signs in front of them, _________
    8·1 answer
  • 7) The small slots on the front, back, or side of your computer that allow you to connect devices (such as a keyboard, mouse, or
    11·1 answer
  • An employee clicks on a link in an email from what looks like a fellow employee and is taken to a fraudulent web site which asks
    6·2 answers
  • Juan copied and pasted information from a Word document
    8·1 answer
  • Python
    7·1 answer
  • Which spreadsheet toolbar displays options such as Cut and Paste?
    11·2 answers
  • Please tell fast plzzzzzzzz​
    11·2 answers
  • Another method that might be desired is one that updates the Goalie's jerseyNumber. This method will receive a new number of Jer
    9·1 answer
  • Need answer ASAP
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!