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
Gemiola [76]
2 years ago
5

In java I need help on this specific code for this lab.

Computers and Technology
1 answer:
rosijanka [135]2 years ago
8 0

Answer:

Explanation:

The following code is written in Java and creates the two methods as requested each returning the desired double[] array with the averages. Both have been tested as seen in the example below and output the correct output as per the example in the question. they simply need to be added to whatever code you want.

public static double[] rowAvg(int[][] array) {

       double result[] = new double[array.length];

     for (int x = 0; x < array.length; x++) {

         double average = 0;

         for (int y = 0; y < array[x].length; y++) {

             average += array[x][y];

         }

         average = average / array[x].length;

         result[x] = average;

     }

     return result;

   }

   public static double[] colAvg(int[][] array) {

       double result[] = new double[array[0].length];

       for (int x = 0; x < array[x].length; x++) {

           double average = 0;

           for (int y = 0; y < array.length; y++) {

               average += array[y][x];

           }

           average = average / array.length;

           result[x] = average;

       }

 

       return result;

   }

You might be interested in
All of the different devices on the internet have unique addresses.
Sindrei [870]

Answer:

Yes

Explanation:

Just like a human fingerprint, no 2 computers are the same.

3 0
3 years ago
4. 15 Exact change (College level not sure why it says middle school)
sweet [91]

Answer:

def print_change(total_change):#this is also total cents, because integers don't have decimal points, so I can't use dollars as my unit

dollars = int(total_change / 100)

remaining_change = total_change - dollars * 100

quarters = int(remaining_change / 25)

remaining_change -= quarters * 25

dimes = int(remaining_change / 10)

remaining_change -= dimes * 10

nickels = int(remaining_change / 5)

remaining_change -= nickels * 5

pennies = remaining_change

all = {'dollar': dollars, 'quarter': quarters, 'dime': dimes, 'nickel': nickels, 'penny': pennies}

for num in [0, 1, 2, 3, 4]:

coin_type = list(all.keys())[num]

amount = all[coin_type]

if num < 4 and amount > 1 or amount == 0 and num < 4:

coin_type += 's'

elif num == 4 and amount > 1 or amount == 0 and num == 4:

coin_type = 'pennies'

print('\n', amount, coin_type)

while True:

total_change = int(input()) #in cents

print_change(total_change)

Had fun making this one... hope it helps. :)

6 0
3 years ago
Will creates an entry in his calendar and marks it as an all-day instance. Which item has he created?
Hatshy [7]

Answer:

The answer u looking for is event

5 0
2 years ago
Read 2 more answers
Code an application program that keeps track of student informationat your college . Include their name, identification numbers,
timurjin [86]

Answer:

The full code is added in the comments as per regulations. Continuation of driver.java code from the comments is available on the screenshot

Explanation:

Editable code:

//ListingNode.java

class ListingNode {

   private listpro listing11;

   private ListingNode nextnode;

   public ListingNode(listpro listing11) {

       this.listing11 = listing11;

   }

   public listpro getListing() {

       return listing11;

  }

   public void setListing(listpro listing11) {

       this.listing11 = listing11;

   }

   public ListingNode getnextnode() {

       return nextnode;

   }

   public void setnextnode(ListingNode nextnode) {

       this.nextnode = nextnode;

   }

}

public class Listlinked {

   private ListingNode headnode;

   public Listlinked() {

       headnode = null;

   }

   public void insert(listpro listing11) {

       ListingNode listingNode = new ListingNode(listing11);

       if(headnode == null) {

           headnode = listingNode;

       } else {

           ListingNode tempval = headnode;

           while (tempval.getnextnode() != null) {

               tempval = tempval.getnextnode();

           }

           tempval.setnextnode(listingNode);

       }

   }

   public listpro fetch(String name) {

       ListingNode tempval = headnode;

       while (tempval != null) {

           if(tempval.getListing().getNamedata().equalsIgnoreCase(name)) {

               return tempval.getListing();

           }

           tempval = tempval.getnextnode();

       }

       return null;

   }

   public boolean delete(String name) {

       ListingNode tempval = headnode;

       boolean found = false;

       if(headnode != null) {

          if(headnode.getListing().getNamedata().equalsIgnoreCase(name)) {

               headnode = headnode.getnextnode();

               found = true;

           } else {

               while (tempval.getnextnode() != null) {

                   if (tempval.getnextnode().getListing().getNamedata().equalsIgnoreCase(name)) {

                       found = true;

                       tempval.setnextnode(tempval.getnextnode().getnextnode());

                       break;

                   }

                   tempval = tempval.getnextnode();

               }

           }

       }

       return found;

   }

   public void printAll() {

       ListingNode tempval = headnode;

       while (tempval != null) {

           System.out.println(tempval.getListing().toString());

           tempval = tempval.getnextnode();

       }

   }

}

//listpro.java

import javax.swing.*;

public class listpro {

   private String Name;

   private int ID;

   private float grade_point;

   public listpro(){

   }

 public listpro(String Name, int ID, float grade_point){

       this.Name = Name;

       this.ID = ID;

       this.grade_point = grade_point;

   }

   public String getNamedata() {

       return Name;

   }

   public void setNamedata(String Name) {

       this.Name = Name;

   }

   public int getID() {

       return ID;

   }

   public void setID(int ID) {

       this.ID = ID;

   }

   public float getgrade_point() {

       return grade_point;

   }

   public void setgrade_point(float grade_point) {

       this.grade_point = grade_point;

   }

   public listpro deepCopy(){

       listpro clone = new listpro(Name,ID,grade_point);

       return clone;

   }

   public String toString(){

       return "Name : " + Name + "\nID :" + ID + "\nGrade points :" + grade_point;

   }

   public void input(){

       Name = JOptionPane.showInputDialog("Enter a Name");

       ID = Integer.parseInt(JOptionPane.showInputDialog("Enter an ID"));

       grade_point = Float.parseFloat(JOptionPane.showInputDialog("Enter a grade point average"));

   }

}

6 0
3 years ago
How has the Internet of Things affected business
PilotLPTM [1.2K]

Answer:

With better information about the consumers and the market, the productivity of any business can be increased notably. IoT devices can be connected to each other and controlled to improve efficiency, which in turn has direct effects on the productivity of the business. More can be done in less time.

Explanation:

4 0
3 years ago
Other questions:
  • The negotiators past relationship will affect current behavior if the parties
    12·1 answer
  • 1. Orthographic Drawings are used to express ideas that are more complicated. Explain the purpose of the different views and the
    7·1 answer
  • What does the merge &amp; center button in the alignment group on the home tab do?
    8·1 answer
  • The DNS server at your headquarters holds a standard primary zone for the abc domain. A branch office connected by a slow WAN li
    14·1 answer
  • Which of these has an onboard key generator and key storage facility, as well as accelerated symmetric and asymmetric encryption
    10·1 answer
  • If the supply of computer engineers increases at the same time that the demand for these workers decreases, what would be the MO
    7·1 answer
  • Mô tả những lợi ích của việc sử dụng đa xử lý không đồng nhất trong một hệ thống di động
    8·1 answer
  • I need help solving this problem on Picoctf. The question is What happens if you have a small exponent? There is a twist though,
    7·1 answer
  • You can easily merge files even if each file contains a different record layout. Group of answer choices True False
    9·1 answer
  • Catherine, a web designer, has created new content for a client's website. In order to update the company website, she needs to
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!