Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem 3 (name this Lab7_Problem3) (Java Program) Excel spreadsheets label colu

ID: 3757680 • Letter: P

Question

Problem 3 (name this Lab7_Problem3)

(Java Program)

Excel spreadsheets label columns with uppercase letters and rows with integer numbers, as you can see below:

Based on nested while loops, write a program that will cycle through an imaginary seven rows (1 through 7) and six columns (A through F) to produce the output shown below. For the output, indicate what row and column is referenced—along with the product of the row multiplied by the ASCII code for the letter of the column.

This is a totally useless, arbitrary thing to do. The product of the ASCII codes has no special meaning; it's just practice to get the code to do it.

Use a void() method to produce each line of output. Pass the method the current row and column; have the method calculate the product (row x col) and display it as shown below.

Your row counter variable is pretty straightforward—it will need to be an int and it will range from 1 to 7. Columns are a little trickier but this should make it simple: recall, characters are stored internally as int values (ASCII codes) so addition and subtraction works against the underlying ASCII value if you cast your fishing line appropriately.

Example output (note that some of the data has been omitted for the sake of space):

Row 1 Col A: 65

Row 1 Col B: 66

Row 1 Col C: 67

Row 1 Col D: 68

Row 1 Col E: 69

Row 1 Col F: 70

Row 2 Col A: 130

Row 2 Col B: 132

Row 2 Col C: 134


Row 6 Col C: 402

Row 6 Col D: 408

Row 6 Col E: 414

Row 6 Col F: 420

Row 7 Col A: 455

Row 7 Col F: 490

Explanation / Answer

Solution:

package com.chegg.nancy.solutions;

public class ExcelSheet {

   public static void main(String[] args) {
       int row = 1;
       int col = 65;
       while (row <= 7) {
           col = 65;
           while (col <= 70) {
               System.out.println("ROW " + row + " Col " + (char) col + ":" + row * col);
               col++;
           }
           row++;
       }
   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote