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
Aleks [24]
3 years ago
8

In this exercise you will debug the code which has been provided in the starter file. The code is intended to do the following:

Computers and Technology
1 answer:
abruzzese [7]3 years ago
8 0

Answer:

The corrected code is as follows:

import java.util.Scanner;

public class U2_L4_Activity_Two{

public static void main(String[] args){

Scanner scan = new Scanner(System.in);

String str1 = scan.nextLine();

String str2 = str1;

str1 = str1.toUpperCase();

System.out.println(str1);

System.out.println(str2);

}

}

Explanation:

This corrects the scanner object

Scanner scan = new Scanner(System.in);

This line is correct

String str1 = scan.nextLine();

This copies str1 to str2

String str2 = str1;

This converts str1 to upper case

str1 = str1.toUpperCase();

This prints str1

System.out.println(str1);

This prints str2

System.out.println(str2);

You might be interested in
If my_string = "This is MY string!", why does print (my_string[0:7:5]) return "Ti" and not
notka56 [123]

In Python, a string is an array of characters, we can access these characters using index operator []. For example, we have a_string = "Hello World" a_string[0] prints the first character in string ('H').

We can also use index operator to make substrings, for example a_string[0:3] will make a substring with first, second, third and fourth character equal to "Hell".

Now to business

my_string = "This is MY string!"

print(my_string[0:7]) # Prints "This is "

print(my_string[0:7:5]) # Prints "T" then prints the sixth character since we start counting at 0 hence prints "Ti" (note that space is also a character).

Hope this helps.

7 0
4 years ago
Steeler corporation is planning to sell 100,000 units for 2.00 per unit and will break even at this level of sales fixed expense
olga_2 [115]

Answer:

1.25 per unit

Explanation:

Number of units to sell = 100,000

Price per unit = 2

Fixed expense = 75000

At break even point :

Revenue = total expenses

Total expenses = fixed cost + variable cost

Let variable cost = x

Revenue = units to sell * price per unit

Revenue = 100,000 * 2 = 200,000

Hence,

Fixed cost + variable cost = Revenue

75000 + x = 200,000

x = 200, 000 - 75000

x = 125,000

Variable cost = 125,000

The variable expense per unit is thus :

Variable expense / number of units

125,000 / 100,000 = 1.25 per unit

7 0
3 years ago
How to convert ascii to hexadecimal?
Deffense [45]
ASCII is an agreement on which number represents which typographic character. Using this table you can look up the number of any character. For instance, "A" has 65, but that is a decimal. Next step is to represent this decimal number in hexadecimal. You can do that by taking the divisor and remainder of a division by 16. Numbers beyond 9 are represented as a through f. Hexadecimal numbers are commonly prefixed by "0x" to make them recognizable.

So "A" = 65 = 4*16+1 = 0x41

And "Z" = 90 = 5*16+10 = 0x5a

There are ASCII tables that have the hexadecimal value in them, to make the task easier (www.asciitable.com).

If you want to do this programmatically, you can write something like this (node.js):

console.log( Buffer.from('AZ', 'utf8').toString('hex'));

Note that the 0x prefix is not shown here.
7 0
4 years ago
The e-mail address of the main recipient of an e-mail belongs in which field?
Sever21 [200]
D) TO, this is because the email is to the main email address
7 0
3 years ago
When you use the ip address of the web server, the correct site is displayed?
jekas [21]
No. Using the address will get you either the default site, or the first site declared. Web servers can host VirtualHosts, and rely on the site name to know which VirtualHost to serve. TMI, it's called name based virtual host, as opposed to the machine having many addresses then address based virtual hosts can be created.
6 0
4 years ago
Other questions:
  • When a policy setting in Computer Configuration and User Configuration in the same GPO conflict, the Computer Configuration poli
    9·1 answer
  • Common input devices include the keyboard, ____, and integrated video cameras.
    12·1 answer
  • Instant messaging allows text only <br> a. True <br> b. False
    9·1 answer
  • Which of the following is an example of a federal tax? A. Social Security tax B. Sales tax C. Property tax D. Transaction tax
    8·1 answer
  • In what software development model does activity progress in a lock-step sequential process where no phase begins until the prev
    7·1 answer
  • 3.
    5·1 answer
  • 1. Define Validation Rule
    14·1 answer
  • The measure means to determine the exact size, amount, or distance of something
    11·1 answer
  • What is the result when you run the following program?
    9·2 answers
  • A type of user interface that features on- screen objects, such a menus and icons, manipulated by a mouse.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!