answer.
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
Brums [2.3K]
1 year ago
14

Without using any additional variables, and without changing the values of ndays or the elements of the parkingTickets array, wr

ite some code that results in mostTickets containing the largest value found in parkingTickets.
Computers and Technology
1 answer:
dusya [7]1 year ago
7 0

Answer:

Explanation:

mostTickets=0;

for (k=0; k< ndays; k++){

if (parkingTickets[k]>mostTickets) mostTickets=parkingTickets[k];

}

You might be interested in
Create an application named SalesTransactionDemo that declares several SalesTransaction objects and displays their values and th
crimeas [40]

Answer:

Explanation:

The following code is all written in Java, first I will add the object initialization and declaration code that can be added to the main method of any program. Then I have also written the entire SalesTransaction class as the question was not clear as to exactly which was needed.

//Object Creation to copy and paste into main method

SalesTransaction sale1 = new SalesTransaction("Gabriel", 25, 5);

SalesTransaction sale2 = new SalesTransaction("Daniela", 5);

SalesTransaction sale3 = new SalesTransaction("Jorge");

//SalesTransaction class with three constructors

package sample;

class SalesTransaction {

   String name;

   int salesAmount, commission;

   private int commissionRate;

   public SalesTransaction(String name, int salesAmount, int rate) {

       this.name = name;

       this.salesAmount = salesAmount;

       this.commissionRate = rate;

       commission = salesAmount * rate;

   }

   public SalesTransaction(String name, int salesAmount) {

       this.name = name;

       this.salesAmount = salesAmount;

       this.commissionRate = 0;

   }

   public SalesTransaction(String name) {

       this.name = name;

       this.salesAmount = 0;

       this.commissionRate = 0;

   }

}

8 0
1 year ago
GJAUDRO: A member of a team. Question 2 with 1 blankARBCUE: Activity that is practiced under the water. Question 3 with 1 blankE
kramer

Answer:

1 jugador

2 bucear

3 equipo

4 ciclismo

5 pasear

6 tenis

Explanation:

ur welcome

6 0
2 years ago
Problem 2 - K-Best Values - 30 points Find the k-best (i.e. largest) values in a set of data. Assume you are given a sequence of
masya89 [10]

Answer:

See explaination

Explanation:

/**KBestCounter.java**/

import java.util.ArrayList;

import java.util.List;

import java.util.PriorityQueue;

public class KBestCounter<T extends Comparable<? super T>>

{

PriorityQueue heap;

int k;

public KBestCounter(int k)

{

heap = new PriorityQueue < Integer > ();

this.k=k;

}

//Inserts an element into heap.

//also takes O(log k) worst time to insert an element

//into a heap of size k.

public void count(T x)

{

//Always the heap has not more than k elements

if(heap.size()<k)

{

heap.add(x);

}

//if already has k elements, then compare the new element

//with the minimum element. if the new element is greater than the

//Minimum element, remove the minimum element and insert the new element

//otherwise, don't insert the new element.

else if ( (x.compareTo((T) heap.peek()) > 0 ) && heap.size()==k)

{

heap.remove();

heap.add(x);

}

}

//Returns a list of the k largest elements( in descending order)

public List kbest()

{

List al = new ArrayList();

int heapSize=heap.size();

//runs O(k)

for(int i=0;i<heapSize;i++)

{

al.add(0,heap.poll());

}

//Restoring the the priority queue.

//runs in O(k log k) time

for(int j=0;j<al.size();j++) //repeats k times

{

heap.add(al.get(j)); //takes O(log k) in worst case

}

return al;

}

}

public class TestKBest

{

public static void main(String[] args)

{

int k = 5;

KBestCounter<Integer> counter = new KBestCounter<>(k);

System.out.println("Inserting 1,2,3.");

for(int i = 1; i<=3; i++)

counter.count(i);

System.out.println("5-best should be [3,2,1]: "+counter.kbest());

counter.count(2);

System.out.println("Inserting another 2.");

System.out.println("5-best should be [3,2,2,1]: "+counter.kbest());

System.out.println("Inserting 4..99.");

for (int i = 4; i < 100; i++)

counter.count(i);

System.out.println("5-best should be [99,98,97,96,95]: " + counter.kbest());

System.out.println("Inserting 100, 20, 101.");

counter.count(100);

counter.count(20);

counter.count(101);

System.out.println("5-best should be [101,100,99,98,97]: " + counter.kbest());

}

}

5 0
2 years ago
When Liam went to print his presentation, the boot process established the connection to the printer, sent the presentation to t
Mars2501 [29]

Answer:

b. False

Explanation:

When Liam went to print his presentation, the boot process established the connection to the printer, sent the presentation to the printer, and let other software know the printer was busy. It is a false statement.

6 0
2 years ago
A large software development company employs 100 computer programmers. Of them, 45 areproficient in Java, 30 in C, 20 in Python,
melisa1 [442]

Answer:

18, 13, 19

Explanation:

Number of computer programmers proficient only in Java = 45 - ( 1+1+6) = 37

Number of computer programmers proficient only in C++ = 30 - (6+1+5) = 18

Number of computer programmers proficient only in python = 20 - ( 1+1+5) = 13

Number of computer programmers are not proficient in any of these three languages = 100 - ( 37 + 18 + 13 + 1+ 1+ 5+ 6 ) = 100 - 81 = 19

4 0
1 year ago
Other questions:
  • Which of the following statements is not true about proper tire care? a.If you see a wear bar across the width of the tread whil
    14·2 answers
  • Which selections are possible for controlling the start time of audio playback? Check all that apply. Automatic Rewind when done
    10·1 answer
  • Given: an int variable k, an int array current Members that has been declared and initialized, an int variable memberID that has
    11·1 answer
  • Refer to the exhibit. Which two network addresses can be assigned to the network containing 10 hosts? Your answers should waste
    7·1 answer
  • Print "userNum1 is negative." if userNum1 is less than O. End with newline Convert userNum2 to 0 if userNum2 is greater than 8.
    10·1 answer
  • This exercise shows why each pivot (in eli1nination by pivoting) must be in a different row. (a) In Example 7, make the third pi
    15·1 answer
  • (1) Output a menu of automotive services and the corresponding cost of each service. (2 pts) Ex: Davy's auto shop services Oil c
    15·1 answer
  • A program is divided into 3 blocks that are being compiled on 3 parallel computers. Each block takes an Exponential amount of ti
    6·1 answer
  • PLEASE HELP!!!
    11·1 answer
  • In the file BankAccount.java, build a class called BankAccount that manages checking and savings accounts. The class has three p
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!