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
puteri [66]
4 years ago
14

Using the NumberFormat class, write code that will create a double called cv, assign it a value of 18.7713, and then convert it

to a String rounded off to the nearest hundredth. Assure that at least 1 decimal place is printed. Print the String.
Computers and Technology
1 answer:
spayn [35]4 years ago
3 0

Answer:

// Program to convert rounded decimal to string

// This program segment is written in Java programming language

// Comments are used for explanatory purpose

// Program starts here

import java.text.D ecimalFormat;

public class RoundNumbers

{

public static void main(String[] args) {

// Declare number and assign value to it

double cv = 18.7713;

// Call decimalformat method

DecimalFormat commaType = new DecimalFormat("#,###.###");

//Convert cv to string

String myPi = commaFormat.format(cv);

// Print result

System.out.println(commaType.format(cv));

}

}

// End of Program

You might be interested in
 How does critically analyzing technology add value to interactions with people in personal and professional contexts?
AysviL [449]

Answer:

Critically analyzing technology helps realize the need for improvement, extension and creativity that technology can bring towards advancement basically both for personal interactions and in professional settings.

Explanation:

It's helps build the need of Technological inclusion for productivity. Thank you.

8 0
3 years ago
Read 2 more answers
Write a generator function named count_seq that doesn't take any parameters and generates a sequence that starts like this: 2, 1
-BARSIC- [3]

Answer:

#required generator function

def count_seq():

   #starting with number 2. using string instead of integers for easy manipulation

   n='2'

   #looping indefinitely

   while True:

       #yielding the integer value of current n

       yield int(n)

       #initializing an empty string

       next_value=''

       #looping until n is an empty string

       while len(n)>0:

           #extracting first digit (as char)

           first=n[0]

           #consecutive count of this digit

           count=0

           #looping as long as n is non empty and first digit of n is same as first

           while len(n)>0 and n[0]==first:

               #incrementing count

               count+=1

               #removing first digit from n

               n=n[1:]

           #now appending count and first digit to next_value

           next_value+='{}{}'.format(count,first)

       #replacing n with next_value

       n=next_value

#testing, remove if you don't need this

if __name__ == '__main__':

   #creating a generator from count_seq()

   gen=count_seq()

   #looping for 10 times, printing next value

   for i in range(10):

       print(next(gen))

Explanation:

6 0
4 years ago
Which of the items listed is not considered to be personal protective equipment (PPE)?
KatRina [158]

Answer:a

a t t i c

Explanation:

6 0
3 years ago
ProcessName2
RoseWind [281]

Explanation:

This is easily solvable with a for loop. Something like:

(I assume c++)

#include <iostream>

#include <string>

int main() {

take_input: //tag

std::string input;

cin >> input; //take the input

int spaceCount = 0;

char checking;

for(unsigned int i = 0; i == input.length(); ++i) {

checking = spaceCount[i];

if(checking == ' ')

spaceCount++;

}

if(spaceCount >= 1 && input.length >= 5)

std::cout << "Your name is " + input;

else

goto take_input; // reasks for input if the conditions are not met

return 0;

};

**remove all spaces before using the code, the if statements are messed up

5 0
4 years ago
A person interested in a career in digital media should have which qualities? Select all that apply.
emmainna [20.7K]
1.Creativity
2.Leadership
3.Attention to detail
5.Enjoyment to learning new things!
6.Vision
No Problem!
5 0
3 years ago
Other questions:
  • That is Entrepreneur ? ?<br>​
    8·1 answer
  • A(n ________ is a program that is used to create, process, and administer a collection of self-describing integrated records.
    14·1 answer
  • Professionalism is defined as what?<br> ASAP PLEASE!
    11·1 answer
  • An indention where the first line of text is indented and the second and succeeding lines start at the left margin is called ___
    8·1 answer
  • Create a class named Invoicing that includes three overloaded computeInvoice() methods for a book store: see pages 196 for examp
    7·1 answer
  • Word documents contain how many sections by default?
    9·1 answer
  • What is internet?<br>what is online?​
    5·1 answer
  • A carver begins work on the following block of granite that weighs 2700 g. What is the density of the granite?
    13·1 answer
  • Anybody wanna be friends?
    10·2 answers
  • When you insert a new slide in a presentation, where is it placed in relation to the existing slides?.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!