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
A ____ may be composed of a few individual objects or several complex groups of objects.
Diano4ka-milaya [45]
A mixture can be composed of a few individual objects or several complex groups of objects.

Hope I helped! ( Smiles )
4 0
3 years ago
What is the typical first shot that everyone takes? In photography
Firlakuza [10]

Answer:

the sky or of nature in general

Explanation:

7 0
3 years ago
Google is the most popular:
Dvinal [7]
Google is the most popular C) Search engine.

  Explore for erudition regarding an individual or anything at the Internet by the usage of the search engine  ---> Google.

7 0
3 years ago
Read 2 more answers
Which element can a composer use to lengthen the duration of tone
sweet-ann [11.9K]
The answer is the element can be used by a composer to lengthen the duration of a tone is dotted note one dot represents the increase in duration of a basic note by half of it's original value
5 0
3 years ago
Read 2 more answers
Complete the getOdds method so it returns a new ArrayList of Integers containing all odd Integers from the parameter ArrayList v
kow [346]

Answer:

Following are the code to this question:

import java.util.*;//import package for user-input

public class U7_L2_Activity Three//defining  class U7_L2_Activity Three

{

  public static ArrayList<Integer> getOdds(ArrayList<Integer> val)//defining a static method getOdds as an ArrayList

  {

      ArrayList<Integer> odd = new ArrayList<Integer>();//creating ArrayList Object  

      int i; //defining integer variable  

      for(i=0;i<val.size();i++)//defining for loop for calculating odd values

      {

          if(val.get(i)%2!=0)//defining if block to check odd numbers

          {

              odd.add(vals.get(i));//add values in odd ArrayList  

          }

      }

      return odd;//return ArrayList odd

  }

  public static void main(String[] asr)//defining main method

  {

      int l,i;//defining integer variable

      Scanner sob = new Scanner(System.in);//creating Scanner calss Object

      ArrayList<Integer> num = new ArrayList<Integer>();//creating ArrayList object  

      System.out.println("Enter length of the ArrayList: ");//print message

       l = scan.nextInt();//input length value

      System.out.println("Enter ArrayList values: "); //print message  

      for(i = 0; i < l; i++)//use for to input value  

      {

          num.add(sob.nextInt());//input value

      }

      System.out.println("Odds list: " + getOdds(num));//calling method getOdds

      System.out.println("Original list: " + num);//print array value

  }

}

Output:

Enter ArrayList length:

7

Enter values:

2

5

8

6

7

3

12

Odds list: [5, 7, 3]

Original list: [2, 5, 8, 6, 7, 3, 12]

Explanation:

In the above-program inside the class, a static method "getOdds "is declared, that accepts an array list in its parameters, and defined an array list "odd", in this a for loop is defined, that check the odd numbers in the array and add the value in the odd Arraylist, and returns its values.

Inside the main method is defined that creates scanner class object for input array value and pass the value into the method "getodds" and print its return values.

3 0
3 years ago
Other questions:
  • The ________________ command tests connectivity by sending an echo request to a remote computer.
    14·1 answer
  • How many check boxes from the following code can be selected at any given time? Home Address Federal Express UPS
    13·1 answer
  • You work in the Accounting Department and have been using a network drive to post Excel workbook files to your file server as yo
    9·1 answer
  • i got a set of headphones and when i plug them into my speakers the right side only works how do i fix the left side of them
    12·1 answer
  • Which one of the following terms is defined as the material and surfaces upon which an artist works?1. Applied arts2. Context3.
    5·1 answer
  • How to write a program to draw 1000 random points on a frame in python language for coding?
    13·1 answer
  • Write a program to complete the task given below: Ask the user to enter any 2 numbers in between 1-10 and add both of them to an
    8·1 answer
  • In a word-processing program, what are the easily accessible icons that allow you to print, save and change fonts with a click o
    8·1 answer
  • Write a 2 paragraph on an African American who has become successful in IT. Need help asap can’t think of anything
    5·1 answer
  • A ______ system writes data on two or more disks simultaneously, thereby creating a complete copy of all the information on mult
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!