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
BabaBlast [244]
4 years ago
7

Given an int variable n that has already been declared and initialized to a positive value, and another int variable j that has

already been declared, use a do...while loop to print a single line consisting of n asterisks. Thus if n contains 5, five asterisks will be printed. Use no variables other than n and j.
Computers and Technology
1 answer:
emmasim [6.3K]4 years ago
6 0

Answer:

The solution code is written in Java.

  1. public class Main {
  2.    public static void main(String[] args) {
  3.        int n = 5;
  4.        int j;
  5.        do{
  6.            System.out.print("*");
  7.            n--;
  8.        }while(n > 0);
  9.    }
  10. }

Explanation:

Firstly, declare the variable n and assign it with value 5 (Line 4). Next declare another variable j.

Next, we create a do while loop to print the n-number of asterisks in one line using print method. In each iteration one "*" will be printed and proceed to the next iteration to print another "*" till the end of the loop. This is important to decrement the n by one before the end of a loop (Line 9) to ensure the loop will only run for n times.

You might be interested in
Answer the following questions which are based on the study "Patients' Engagement with Sweet Talk." Submit your answers.
eimsori [14]

Answer:

HURRY

Dr. Khan works for the marketing department of a company that manufactures mechanical toy dogs. Dr. Khan has been asked to assess the effectiveness of a new advertising campaign that is designed to be most persuasive to people with a certain personality profile. She brought four groups of participants to the lab to watch the video advertisements and to measure the likelihood that they would purchase the toy, both before and after watching the ad. The results of Dr. Khan’s study are presented below.

Part A

Explain how each of the following concepts applies to Dr. Khan’s research.

Survey

Dependent variable

Big Five theory of personality

Part B

Explain the limitations of Dr. Khan’s study based on the research method used.

Explain what Dr. Khan’s research hypothesis most likely was.

Part C

Use the graph to answer the following questions.

How did the trait of agreeableness affect how people responded to the new ad campaign?

How did the trait of conscientiousness affect how people responded to the new ad campaign?

7 0
3 years ago
Describe how computer are used in ticket counter?​
m_a_m_a [10]

Answer:

These systems are commonly used in facilities such as public libraries to ensure equitable use of limited numbers of computers. Bookings may be done over the internet or within the library itself using a separate computer set up as a booking terminal.

6 0
3 years ago
Complete the below function which dynamically allocates space to a 3d array of doubles, initializes all values to 0, and returns
MAVERICK [17]

Answer:

Explanation:

1. double ***alloc3dArrayOfInts( int length, int width, int depth) {

2. double ***array3d = malloc(length * sizeof(double **) );

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

4. array3d[i] = malloc(width * sizeof(double *) );

5. for(int j=0; j< width;j++) {

6. array3d[i][j] = malloc(depth * sizeof(double) );

7. }

8. }

9. return array3d;

10. }

5 0
3 years ago
Describe the purpose of shell scripts. Provide one example to reflect the use of variables, constructs, or functions.
Sindrei [870]

Answer:

Kindly check explanation

Explanation:

Shell scripts are used for writing codes which may involve writing together a complete set of task in a single script. These set if codes or instructions could be run at once without having to run this program one after the other on a command line. This way it avoid having to repeat a particular task each time such task is required. As it already combines a sequence of command which would or should have been typed one after the other into a compiled single script which could be run at once.

A shell script could be written for a control flow construct :

if [expression]

then (command 1)

else (command 2)

.....

7 0
3 years ago
Six external parts or periphersal of a computer system
BARSIC [14]


1.) Keyboard

2.) Mouse

3.) monitor

4.) printers

5.) speakers

6.) microphone

3 0
4 years ago
Other questions:
  • What protocol must be supported by routers in order to utilize remote assistance easy connect?
    10·1 answer
  • To change the caption for a field in a query, click the field in the design grid, click the ____ button on the Design tab, click
    14·1 answer
  • A software architecture that divides an application into view, business logic, and data is called a(n) ________.â
    14·1 answer
  • Write a Python function merge_dict that takes two dictionaries(d1, d2) as parameters, and returns a modified dictionary(d1) cons
    5·1 answer
  • How long would it take a 8 bit computer to calculate π to the thousandth place?
    8·1 answer
  • Match the command to the use. Test connectivity to a remote computer Test DNS lookup View packets in a transmission Display the
    14·1 answer
  • Consider an allocator on a 32-bit system that uses an implicit free list. Each memory block, either allocated or free, has a siz
    11·1 answer
  • How would you reply to an email message you've received that has multiple recipients, all of whom you would like to see your rep
    6·2 answers
  • A.)Distinguish between software suite and integrated software.
    7·1 answer
  • Limited time only for christmas give yourself free 100 points YES YES yes yes yes
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!