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
Karolina [17]
2 years ago
13

Write a program that prompts the user to enter a string (may contain spaces) and displays its last character. Enter s string: Pr

ogramming is fun The last character is n
Computers and Technology
1 answer:
STALIN [3.7K]2 years ago
3 0

Answer:

<em>The programming language in Python is as follows:-</em>

#Prompt user for input string

userinput = input("Enter a string: ")

#Print the last character of the input

print("The last character is "+userinput[-1])

#End of Program

Explanation:

This line is a comment

#Prompt user for input string

This line prompts user for input

userinput = input("Enter a string: ")

This line is also a comment

#Print the last character of the input

This next line prints the last character of the input string; the last character is defined by the index -1

print("The last character is "+userinput[-1])

You might be interested in
Select the correct answer from each drop-down menu
Lana71 [14]

Answer:

The purpose of the domain name is for credibility and location purposes.

Explanation:

For example.

nz.gov means that the domain owner is the government on New Zealend

8 0
2 years ago
How should a cover letter begin?
Alenkinab [10]
To professionally adress an introduction in a cover letter D. would be the correct answer.
4 0
2 years ago
Read 2 more answers
Which course must first-time drivers in Florida take to be eligible for their Learner License?
Travka [436]
The Traffic Law and Substance Abuse Course (TLSAE), which is also known as the drug and alcohol course.
7 0
3 years ago
File Sales.java contains a Java program that prompts for and reads in the sales for each of 5 salespeople in a company. It then
myrzilka [38]

Answer:

import java.util.Scanner;

public class Sales

{

public static void main(String[] args) {

   

    int sum;

    Scanner input = new Scanner(System.in);

   

    System.out.print("Enter number of salespeople: ");

    int salespeople = input.nextInt();

    int[] sales = new int[salespeople];

       

    for (int i=0; i<sales.length; i++)

    {

     System.out.print("Enter sales for salesperson " + (i+1) + ": ");

     sales[i] = input.nextInt();

    }

    System.out.println("\nSalesperson   Sales");

    System.out.println("--------------------");

    sum = 0;

       int maxSale = sales[0];

       int minSale  = sales[0];

       int minId=1;

       int maxId=1;

    for (int i=0; i<sales.length; i++)

    {

               System.out.println("     " + (i+1) + "         " + sales[i]);

 sum += sales[i];

  if(maxSale < sales[i])

           {

               maxSale = sales[i];

               maxId = i+1;

           }

           if(minSale > sales[i])

           {

               minSale = sales[i];

               minId = i+1;

           }

   }

System.out.println("Total sales: " + sum);

       System.out.println("The average sale is: " + sum / salespeople );

       System.out.println("Salesperson "+ maxId + " had the highest sale with "+ maxSale + ".");

       System.out.println("Salesperson "+ minId + " had the lowest sale with "+ minSale + ".");

       

       int amount = 0;

       int counter = 0;

       System.out.print("Enter an amount: ");

       amount = input.nextInt();

       for (int i=0; i<sales.length; i++)

    {

     if(sales[i] > amount) {

         counter++;

         System.out.println("Salesperson "+ (i+1) + " exceeded given amount. (Number of sales: " + sales[i] +")");

     }

    }

       System.out.println("Number of salespeople exceeded given amount is: "+ counter);

}

}

Explanation:

- Ask the user for the number of salesperson

- According to entered number, create an array called sales to hold sale number for each person

- In the first for loop, assign the given sales numbers

-  In the second for loop, print all the sales people with sales, calculate the total sales. Also, find the minimum and maximum sales numbers with associated individuals.

- Print total, average, highest, and lowest sales.

- Ask user enter an amount

- In the third for loop, find the sales people who exceeded this amount.

- Print number of sales people who exceeded the amount.

8 0
3 years ago
A mom is planning a theme park trip for her husband, herself, and their three children. The family has a budget of $500. Adult t
dolphi86 [110]

Complete question :

Sue is planning a theme park trip for her husband, herself, and her three children. She has a budget of $500. Adult tickets cost $55 each, and child tickets cost $25 each. Which formula should go in cell B4?

Answer:

=E1B1+E2B2

Explanation:

Cost of adult ticket = $55

Child ticket = $25

Number of adult = 2

Number of children = 3

Assume :

Cost of adult ticket = $55 = E1

Child ticket = $25 = E2

Number of adult = 2 = B1

Number of children = 3 = B2

The formula that should go into cell B5 in other to calculate total amount :

Total should be :

($55*2) + ($25*3)

=E1B1+E2B2

6 0
2 years ago
Other questions:
  • Click to move a stacked object to the top of the stack?
    8·1 answer
  • Question 1 (1 point)
    10·2 answers
  • A struggle between opposing forces or characters is
    14·1 answer
  • Write a program "addnumbers.c" where it takes as many arguments as the user includes as command line arguments and calculates th
    11·1 answer
  • A descriptive study represents the highest level on the knowledge-level continuum.
    11·1 answer
  • Which value can be entered to cause the following code segment to display the message: "That number is acceptable." int number;
    11·1 answer
  • Im getting hit offline can someone help or give me some advice
    6·1 answer
  • A program that doesn’t work properly needs to be debugged. true or false
    8·1 answer
  • Which of the following is NOT a file format used for word processing documents? A. .ppt B. .rtf C. .doc D. .odt
    5·1 answer
  • Hannah is editing her brother’s birthday video. She has selected the usable shots and copied them onto her computer. What is the
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!