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
inessss [21]
3 years ago
5

Assume that given , middle and family are three variables of type string that have been assigned values . Write an expression wh

ose value is a string consisting of the first character of given followed by a period followed by the first character of middle followed by a period followed by the first character of family followed by a period: in other words, the initials of the name . So if the values of these three variables were "John" "Fitzgerald" "Kennedy", then the expression 's value would be "J.F.K."
Computers and Technology
1 answer:
Rama09 [41]3 years ago
4 0

Answer:

String initials = given.charAt(0) + "." + middle.charAt(0) + "." + family.charAt(0) + "." ;

Explanation:

The code has been written in Java.

To get the first character of a String variable say, name, the syntax is:

name.charAt(0);

Zero(0) in the above expression indicated the position of the first character.

Therefore, to get the first character of the string given, we have

given.charAt(0).

To get the first character of the string middle, we have:

middle.charAt(0);

To get the first character of the string family, we have:

family.charAt(0);

Concatenating all of these first characters together and separating them by a period(.) we have;

given.charAt(0) + "." + middle.charAt(0) + "." + family.charAt(0) + "." ;

These will form a string which can be stored in a String variable, say 'initials', as follows;

String initials = given.charAt(0) + "." + middle.charAt(0) + "." + family.charAt(0) + "." ;

Hope this helps!

You might be interested in
Prompt the user to input five pairs of numbers: A player's jersey number (0 - 99) and the player's rating (1 - 9). Store the jer
tiny-mole [99]

Answer:

  1. import java.util.Scanner;
  2. public class Main {
  3.    public static void main (String [] args) {
  4.        int jersey_num [] = new int[5];
  5.        int rating [] = new int[5];
  6.        Scanner inStream = new Scanner(System.in);
  7.        for(int i=0; i < 5; i++){
  8.            System.out.print("Enter player " + (i+1) + "'s jersey number:");
  9.            jersey_num[i] = inStream.nextInt();
  10.            System.out.print("Enter player " + (i+1) + "'s rating:");
  11.            rating[i] = inStream.nextInt();
  12.        }
  13.        System.out.println("ROSTER");
  14.        for(int j=0; j < 5; j++){
  15.            System.out.println("Player " + (j+1) + "-- Jersey number: " + jersey_num[j] + ", Rating: " + rating[j]);
  16.        }
  17.    }
  18. }

Explanation:

The solution code is written in Java. Firstly create two array, jersey_num and rating, with int type. This is to hold the five pairs of numbers input by user (Line 6 -7).

Next, create a for loop that run for 5 iterations and in each iteration prompt user to input jersey number and rating (Line 11 -17). The input number and rating will be set to the array, jersey_num and rating, respectively.

Next, print the title "Roster" (Line 19).

Create another for loop to display the five input pair of values (Line 21 - 23).

3 0
3 years ago
Given a variable s that is associated with the empty string, write some statements that use a while loop to associate s with a s
ArbitrLikvidat [17]

Answer:

Following are the program in the Python Programming Language.

#declare empty string variable

s=""

#declare variable that store "*" as string

x= "*"

#set the while loop

while(len(s) < 777):

   #initialize the value of 'x' in 's'

   s= x

   x += "*"

Explanation:

<u>Following are the description of the program</u>.

  • Set an empty variable to store the string type values.
  • Again, set a variable 'x' and initialize asterisks in it as a string.
  • Set the while loop that iterate, when the length of the variable 's' is less than 777, then initialize the value of the variable 'x' in the variable 's' and concatenate asterisks with the variable 's'.
8 0
3 years ago
What is the term for a web site and network used only by employees within a company?
slega [8]
Local area network is the term
5 0
4 years ago
Mail merge can be used in business to complete which of the following tasks
Likurg_2 [28]

Answer:

Mail merge lets you create a batch of documents that are personalized for each recipient. For example, a form letter might be personalized to address each recipient by name. A data source, like a list, spreadsheet, or database, is associated with the document.

8 0
4 years ago
Read 2 more answers
What are the 4 types of satellite?​
swat32

✨ Yøur answer in thé, Attachment ✨

5 0
3 years ago
Read 2 more answers
Other questions:
  • Phillip wants to create a new Google Display Ad campaign and base his targeting on an existing remarketing list named Checkout A
    10·1 answer
  • Define the missing method. licenseNum is created as: (100000 * customID) licenseYear, where customID is a method parameter. Samp
    14·2 answers
  • Write a java program that accepts the ingredients for a recipe in cups and converts to ounces
    10·1 answer
  • Piers wants to take a course on XML. He is a certified web designer, but he has not used XML before. How can he use XML to impro
    8·1 answer
  • Explain why you cannot the Apple OS install on a regular windows computer and vice versa, without the aid of a virtualization so
    5·1 answer
  • The three Fs of product design are form, fit and
    7·2 answers
  • Im on Edge 2021 and i did an assignment that says, "Processing." The assignment won't give me a grade and says it is overdue. wh
    10·1 answer
  • When an instruction is sent to the CPU in a binary pattern, how does the CPU know what instruction the pattern means
    7·1 answer
  • In this exercise you will debug the code which has been provided in the starter file. The code is intended to do the following:
    8·1 answer
  • What is the difference between EPROM and EEPROM, explain why​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!