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
leonid [27]
3 years ago
6

Consider the following two code segments: Segment 1: while (k > 0) { System.out.println(k); k--; } --------------- Segment 2:

while (k > 0) { System.out.println(k); k--; } while (k > 0) { System.out.println(k); k--; } Assume that in both cases variable k has the same initial value. Under which of the following conditions will the two code segments produce identical output.

Computers and Technology
1 answer:
zepelin [54]3 years ago
6 0

Answer:

Always same value

Explanation:

These both code segments will always generate identical values given that we provide same value of k to both segments.

You can see attached pictures.

You might be interested in
A method to accept the number of drawers in the desk as input from the key board. This method returns the number of drawers to t
Julli [10]

Answer:

Following code takes the information about the wood from the user, do the process of calculating the value according to there type and numbers, then add the surcharge to it while giving the answer to the user.

For differentiating the type of woof i used the if then else statement while i used switch case statement for assigning the appropriate value according to the types of the wood will be processing in the program.

The code is given below:

Explanation:

Code:

namespace std;\\ any name instead of std.

{

   class Program

   { \\ starting the main program

       static void Main(string[ ] args)

       {

           int numberOfDrawers = 0;

           string deskWoodType = "o";

           double cost = 0;

           drawersMeth(numberOfDrawers);

           woodTypeMeth(deskWoodType);

           CalculateCostMeth(numberOfDrawers, cost, deskWoodType);

           OutPutCostMeth(deskWoodType , cost, numberOfDrawers);

       }//end main

       private static void drawersMeth(int numberOfDrawers)

       {

           int numOfDrawers;

           Console.WriteLine("Enter the number of desk drawers");

           numOfDrawers = Convert.ToInt16(Console.ReadLine());

           numberOfDrawers = numOfDrawers;

       }//end drawersMeth

       private static string woodTypeMeth(string deskWoodType)

       {

           Console.WriteLine("Enter the desk wood type. (eg. type mahogany, oak, or pine)");

           deskWoodType = Convert.ToString(Console.ReadLine());

           switch (deskWoodType)

           {

               case "mahogany":

                   {

                       deskWoodType = "m";

                       break;

                   }

               case "oak":

                   {

                       deskWoodType = "o";

                       break;

                   }

               case "pine":

                   {

                       deskWoodType = "p";

                       break;

                   }

               default:

                   {

                       deskWoodType = "error";

                       break;

                   }

           }

           return deskWoodType;

       }// end woodTypeMeth

       private static int CalculateCostMeth(string deskWoodType, int numberOfDrawers, int cost)

       {

           int pine = 100;

           int oak = 140;

           int other = 180;

           int surchage = 30;

           if (deskWoodType == "p")

               cost = surchage + (numberOfDrawers *pine );

           else if (deskWoodType == "o")

               cost = surchage + (numberOfDrawers *oak );

           else

               cost = surchage + (numberOfDrawers *other );

           return cost;

       }// end CalculateCostMeth

       private static void OutPutCostMeth(int numberOfDrawers, string deskWoodType, int cost)

       {

           double totalCost = cost;

           Console.WriteLine("The number of drawers is {0}", numberOfDrawers);

           Console.WriteLine("The wood finish you have selected is ", deskWoodType);

           Console.WriteLine("The total cost is {0}", totalCost);

       }//end outputCost

   }//end class

}//end nameSpace

5 0
3 years ago
A is a way for students to keep track of information during research
Ilya [14]
The choices are a) credible website B)search log c) Boolean operator d) online database.

The answer is, d. Online database. There are already numerous online digital tools that can aid research. Examples are readcube, mendeley, google scholar. It helps you save and organize researches as well as automatically give bibliographies according to your need like APA and MLA. These tools can hold and save different information that researchers need.
6 0
2 years ago
13. An Internet Service Provider (ISP) is a company that builds the routers and wired connections that allow individuals to acce
valentinak56 [21]

Answer:

C. redundant networks are more reliable.

Explanation: I just got a 100 on a test and that question was asked.

7 0
3 years ago
HELLLLPP ME ILL GIVE YOU 14 POINTS Part Three. Imagine that one of your clients has complained to your manager that you have not
vovikov84 [41]
I'm so sorry for not respond quickly to my client's emails 
 
4 0
3 years ago
Read 2 more answers
Do warnings ever expire?
DIA [1.3K]
What’s a warning? how do i get one haha
7 0
3 years ago
Read 2 more answers
Other questions:
  • Suppose an instruction takes 4 cycles to execute in an unpipelined CPU: one cycle to fetch the instruction, one cycle to decode
    10·1 answer
  • Formatting can be applied to
    10·2 answers
  • If userA wants to send a secure message to userB using an asymmetric cryptographic algorithm, which key does userB use to decryp
    11·1 answer
  • Which website allows you to host your podcast for at a cost that includes your domain name?
    9·2 answers
  • Normal wear and road conditions can take their toll on a car’s steering and suspension system, altering __________. A. wheel ali
    15·2 answers
  • Dynamic alliance networks work best in industries: a. that are mature and stable in nature. b. where the coordination of product
    9·1 answer
  • Which of the following scan only works if operating system’s TCP/IP implementation is based on RFC 793?
    12·1 answer
  • What is software infrastructure?
    15·1 answer
  • MEOWWWWWRARRARARARARRA
    5·1 answer
  • What is thesql command to list the total sales by customer , month , and product, with subtotals by customer and by month and a
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!