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
swat32
3 years ago
12

Write a function named joinStrings() that keeps asking the user for words and joins them together. Each word should start with a

n uppercase letter and the rest of letters in the word should be lowercase. All the words should be separated by a space. When the user decides to stop, return the joined string
Computers and Technology
1 answer:
Tamiku [17]3 years ago
4 0

Answer:

* The code is in Python

def joinStrings():

   join = ""

   while True:

       str = input("Enter a word or Q to stop: ")

       if str == "Q":

           break

       else:

           join = join + " " + str

   return join

print(joinStrings())

Explanation:

Create a function called joinStrings

Initialize join variable to hold the strings that will be combined

Create a while loop that stops when user enters "Q". Otherwise, ask the user for a new string and join it to the join variable with a space

When the loop is done, return the join

Call the function and print the result

You might be interested in
In a network, a computer that performs specific services for other computers on the network is called a
klio [65]
Motherboard or main sequence processor 
(either that  a mainframe or a server)
hope this helps

8 0
3 years ago
JAVA Code:
Burka [1]
Dear ,you should ask it on stackoverflow and geekforgeelks , not here
6 0
3 years ago
Write a Java program that can calculate and print out the area of a circle. The user enters data of the radius and its measureme
mezya [45]

Answer:

// program in java.

// package

import java.util.*;

// class definition

class Main

{

   // main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

  // Scanner object to read input

Scanner scr=new Scanner(System.in);

 // variables

double rad;

String unit1="in";

String unit2="ft";

String unit3="cm";

String unit4="m";

// ask user to enter radius

System.out.print("Enter the radius: ");

 // read radius

rad=scr.nextDouble();

 // check radius is negative or not

while(rad<0)

{

    System.out.println("Radius can't be negative:");

     // ask again to enter radius

    System.out.print("Enter the Radius again:");

     // read radius again

    rad=scr.nextInt();

}

// ask user to enter the unit of measurement

System.out.print("Enter the unit (\"in\" for inch, \"ft\" for feet, \"cm\" for centimeter, and \"m\" for meter):");

 // read unit

 String unt=scr.next();

 // calculate area

double area=3.14*rad*rad;

 // print area and unit

if(unt.equals(unit1))

    System.out.println(area+" inch.");

else if(unt.equals(unit2))

    System.out.println(area+" feet.");

else if(unt.equals(unit3))

    System.out.println(area+" centimeter.");

else if(unt.equals(unit4))

    System.out.println(area+" meter.");

   }catch(Exception ex){

       return;}

}

}

Explanation:

Read radius of circle from user with Scanner object and assign it to variable "rad".Check the radius is negative or not.If the radius is negative ask user to enter radius again until user enters a positive radius.Then read the unit of measurement.calculate the area of circle and print area with unit.

Output:

Enter the radius: -4

Radius can't be negative:

Enter the Radius again:6

Enter the unit ("in" for inch, "ft" for feet, "cm" for centimeter, and "m" for meter):cm

Area of circle is 113.03999999999999 centimeter.

5 0
4 years ago
A 4-way set associative cache has 64 blocks of 16 words. How many bits are there in the ""tag"" field of the 15-bit address for
Tanya [424]

Answer:

3 bits

Explanation:

Given a 4- way set associative cache that has 64 blocks of 16 words.

Therefore, the number of sets cache has:

\frac{64}{4} = 16

Now,

Cache data size is 16kB

The number of cache blocks can be calculated as:

16kB/16 = 1024 bytes/16 byte\times 16 = 256 cache blocks

Now,

Total sets = \frac{cache blocks}{associative sets}

Total sets = \frac{256}{4} = 64

Now,

2^{n} = 64

n = 6

For 15 bit address for the architecture, the bits in tag field is given by:

15 - (6 + 6) = 3 bits

Thus the tag field will have 3 bits

6 0
3 years ago
Write a function negateOdds that takes a list of integers and returns a list of integers with all of the odd integers negated. n
aleksley [76]

Is this computer science?

If so, then the function you would need for your code is this...

_____

if (someValue%2 != 0) {

 value *= -1;

        }

_____

//basically <u>number%2 == 0</u> means even so "!" means false so "not even" meaning "odd."

Assuming you are doing an array list (given a set value) or a for-loop with an

int someValue = Integer.parseInt(args[i]); inside (not given a set value and not restricted)

Otherwise ignore me....lol

5 0
3 years ago
Other questions:
  • True or false: Sony is the company behind the creation of the ‘Super Mario Bros.' franchise.
    8·2 answers
  • What is one difference between a web page and a web application? Web pages provide information, while web applications allow the
    8·1 answer
  • Question 2 Unsaved Which of these is NOT an example of an emerging technology? Question 2 options: Sixth Sense Close Range Drone
    6·1 answer
  • A smart phone is always a _____.<br> client<br> server<br> network<br> process
    10·1 answer
  • Lesson 3 - Calling All Operators
    6·1 answer
  • What does the top level domain in a url inducate? A. The organization or company that owns the website. B. The organization or c
    6·2 answers
  • Which feature of REPL.it would you use to transmit your program to a friend?
    12·1 answer
  • 6. kinukuha nito ang kabuuang bilang ng mga numerical na datos sa mga piniling cells
    12·1 answer
  • Consumers affect which goods and services are produced because they _____.
    7·1 answer
  • PLEASE HELP ME
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!