Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q6: [25 marks] Do you know how mobile phone works? They connect to base station to send and receive messages and voice packages. Each base

image text in transcribed
image text in transcribed
Q6: [25 marks] Do you know how mobile phone works? They connect to base station to send and receive messages and voice packages. Each base station will handle a large number of smart phones' request. Assume one base station * can only process one request from one mobile phone. Each request need a certain time to be processed. When the base station is busy, incoming request should wait in line. Assume that a base station has a maximum * capacity N, which indicates that it can only keep N requests waiting * in the line, otherwise, it will crash. Given an array of incoming request time and another array indicates corresponding process times. * Please implement the crash method in 06 for the simulation of base station. * The method will return the crash time for the base station. If the system * will not crash for the given requests, return -1. * For example, given * arrival time - [1,4,4,5,7,10,12] and task required time - (3,9,12,9,10,4,3] * if the maximum capacity N-1, the result of crash time will be 5 if the maximum capacity N-2, the result of crash time will be 7 * if the maximum capacity N-3, the result of crash time will be 10 * if the maximum capacity N-4, the result of crash time will be 12 * if the maximum capacity N-5, the result of crash time will be -1 int[] arrival = {1,4,4,5,7,10,12}; int[] task- {3,9,12,9,10,4,3}; int capacity - 3; System.out.println("06 - [25 marks] System.out.println(Q6.crash(arrival, task, capacity)); 3 class 06 { public static int crash(int[] arrival, int[] task, int capacity) { //TODO return; } )

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions

Question

Were the decisions based on appropriate facts?

Answered: 1 week ago