AdAgency Client
-adAvailabilityArr:Stringl]static -clientName:String
counter: int static
adRequirement: String
-client:Client budget: int
bookingld String paymentType: String
adPackage: String +Client[clientName: String,
clientCollab: boolean adRequirement: String, budget : int
-totalBillAmount:int paymentType: String) YXNoa
+AdAgency (client:Client, ad Package: +getAdRequirement():String
String, clientCollab: boolean) +getBudget(): int
+getAdPackage() :String +getPaymentTypel):String
+getClient0: Client +validateClient(): boolean
+getClientCollab|): boolean +validateClientAdRequirement()
+getTotalBillAmount(): int Boolean
+getBookingld(): String
+getAdAvailabilityArr) String static
+setBookingld(bookingld: String) void
+setTotalBillAmountftotalBillAmount
int):void
+generateBookingld () : void
+identifywaveOffPercent():Integer
+calculateTotalBill(): void abstract
OutdoorAdAgency
-outdoorAdTypeArr String]static
outdoorAdTypeCostArr: int[] static
outdoorAdType: String
displayTimeFrame : int
quantity: int
+OutdoorAdAgency(client: Client,adPackage
String, clientCollab:boolean, outdoorAdType
String, displayTimeframe:int, quantity: int)
AdAgency (client, adPackage, clientCollab)
+calculateTotalBill): void
Do not include any extra instance/static varialbles and
instance/static methods in the given classes
Case-insensitive comparison is to be done if not explieitly mentioned
D o not change any value or case of the givern variables
Read notes and
I n the derived
examples for better understanding of the logic
classes, the order of passing arguments to the
constructor would be base class variables followed by derived class variable
Implementation Details: YXNoaWxhLmlhdGhid3M
Class Name Implementation Details
AdAgency Partially implemented
OutdoorAdAgency Partially implemented
Client Partially implemented
AdAgency class:
adAvailabilityArr:
This is a static array (Stringl) which contains availableserviceArea (String) as its elements
.The initial value of the
adAvailabilityArr is as below
adAvailabilityArr ("Product", "Service, "Marketing", "Brand"
Note:
This array is supplied and hence, no need to code
Do not change the CASE of the elements in the array
generateBookingld):
This method auto-generates and sets bookingld (String)
The bookingld must be prefixed by first character of adRequirement in uppercase followed by the
The auto-generated value would be incremented auto-generated value starting from
by one for the next bookingld
QuestiOn x
Agency java [Link]
generateBookingld0: OutdoorAdAdAgency java [Link]
This method auto-generates and
The bookingld must be
sets bookingld (String)
The prefixed by first character of
auto-generated value would be incremented adRequirement
auto-generated value starting from 10102:03:34
in
Use static variable counter by
for the one uppercase followed by the
appropriately to implement the next bookingld
Example: The first bookingld would be auto-generation logic
on S101e if the
adRequirement is service the second
wov
heRM92Lhihher@raedswent is
Brand and so
identifyWaveOffPercent(0:
.This method finds and returns
the
Refer the below table to waveOffPercent (Integer) based on the
budget (int) provided by the client
identify the waveOffPercent
budget waveOffPercent
Less than or equal to 20000bo
Between 200000 (excluded) and 500000
(included
Greater than 50000o 10
Example: If the budget is 500000, then the waveOffPercent would be 55
Client class:
validateClientAd Requirement0:
This method checks if the adRequirement (String) is present in the adAvailabilityArr of AdAgency class and returns a Boolean value
If it is present then, return true
Otherwise, return false
Note: Perform case-insensitive string comparison
Go RUn Terminal Exam Help
Reterence Question x [Link] [Link] OutdoorAdAgency java [Link]
Example: If ad Requirement isservice then, above method returns true
inees 02:03:14
OutdoorAdAgency class:
usingjava
[Link]
outdoorAdTypeArr:
This is a static array (Stringl) which has
YXNoaWNxhLm1hdGhld3 M =
[Link] adType (String) as its elements
The initial value of the outdoorAdTypeArr is as below:
[Link]
[Link] outdoorAdTypeArr "Billboard", "Transit" "Banner"
usingjava
[Link] Note:
ntjava
This array is supplied and hence, no need to
doorAdAgencyj. code
D o not change the CASE of the elements in the
erjava array
outdoorAd TypeCo Arr:
This is a static array (int) which has
costPerAdTypeint) as its elements
This array has one to one correspondence with outdoorAdTypeArr
The initial value of the
outdoorAdTypeCostArr is as below
outdoorAdTypeCostArr {250, 17o, 150)
Note:
This array is supplied and hence, no need to code
calculateTotalBill 0:
.This method and sets the
generates bookingld (String) and calculates and sets the totalBillAmount (int) to be paid by the client based on the following
ENCIES logic:
Invoke validateClient() and
d5fad4c validateClientAd Requirement() methods of Client class
If both the methods return true,
o If outdoorAdType is present as one of the elements in outdoorAdTypeArr
Identifv the [Link]) far the outdoorAdTyne fro
Question x
[Link] [Link]
calculate Total Bill 0 OutdoorAdAgency ava
[Link]
This method generates and sets the
logic: bookingld (String) and calculates and sets the
totalBillAmount (int)
Invoke
validateClient0
I f both the methods
and
return true, validateClientAdRequirement() methods of Client class
to be paid by the client based 02:02:58
o If
outdoorAdType
is present as one of the elements in
ldentify the corresponding costPerAdType (int) foroutdoorAdTypeArr,
the
Invoke generateBookingld) method outdoorAdType from outddofAaDgpetsstAPm
Invoke the 1hdGhld3M=
identifyWaveOffPercent(0 method to find the waveoffPercent
Calculate the adCost (int)
I f the adPackage
as a
product of costPerAdType,
quantity ordered and displayTimeFrame (int)
(String)
additional currency 2000 toisDigital required (in months)
then add additional
adCost currency 5000 to adCost, otherwise
I n addition, if the if the ad Package is Traditional then add
clientCollab (boolean) is true and the
obtained adCost paymentType (String) of client isPrepaid,
Note: then apply the waveOffPercent on the
Perform
case-sensitive
The valid values of
comparison
for
outdoorAdType
The valid values of
paymentType are either
Prepaid orPostpaide. Perform case-sensitive comparison for
adPackage
S e t the totalBillAmount to be
are
eitherDigital
or
Traditional Perform case-insensitive paymentType
I f the totalBillAmount is
paid with the obtained
adCost comparison for adPackage
exceeding the budget
provided, set the
bookingld toNA and totalBillAmount to -1
oOtherwise, set the bookingld to
Otherwise, set the bookingld to NAand
totalBillAmount to -1
and NA totalBillAmount to -1
Assumption: The valid values would be passed for adPackage and paymentType
Note: No need to validate the
assumption
Example
If the clientName is
Golndia, adRequirement is service budget is currency 500000, paymentType is
is
outdoorAdType is Banner quantity required is 500 for a displayTimeFrame of 6 months, thenPrepaid
true, adPackage is Digital clientCollal
the bookingld for the client
(assuming first client) and the totalBilIAmount to be paid would be currency 432250. would be S101e
Onatiom.2Dete
Reference Question x [Link] [Link]
dssunm 1y THSt CUenL) diiu I Te
LOLdiDIIAnounu LO De
pdlu wouIu De
OutdoorAdAgency
Cuneny 45cL3U.
java [Link]
Question 2: Data Structures:
[5 Marks]
02:02:44
Problem Statement:
Description: Consider an inStrQueue (String Queue) containing
non empty strings as its elements. YXNoaWxhLm1hdGhid3 M=
Write a Java function that accepts above
inStrQueueas input parameterand returns a
non-empty outStrStack (String Stack)based on the logic given
Consider the elements of
below
inStrQueue from front to rear. Each element of inStrQueue is a
The card ends with string that represents a card among the deck of 52 cards.
Ce s D or H which denote the suits Clubs,
denoting Queen, Ace, King and Jack respectively or ranks ranging from Spades,
Diamonds and Hearts respectively,
or J
2 to 10.
preceded by Q A. K
from Apart these, the card can be joker element
Example: 2H denotesTwo of
Hearts Qs denotesQueen of Spades
Obtain an outStrStack (Top-> Bottom) such that
O All the card elements
having 0 A K
orJ are added in the reverse order as in the inStrQueue (Front >Rear) at the
containing ranks 2 to 10 addedin the same order as in inStrQueue (Front-> Rear), followed bytop
outStrStack followed by all the card elements of
all the
joker card elements added at the bottom of the outStrStack in the same order as in
inStrQueue (Front -> Rear)
Note: Perform case-insensitive comparison for joker elements and case-sensitive
comparison for card elements withQ A KO or J
Assumptions:
The size of outStrStack is always equal to the size of inStrQueue
The occurrence of any of the 3 kinds of card mentioned above is not mandatory
inStrQueue would not be empty
Only valid values would be passed to inStrQueue
Note: No need to validate the assumptions
Example:
inStrQueue(Front->Rear): 2 C , 3S AC 9D Joker 8S 4D QH JOKER joker
02:0247
hli02NDM5MTL h a M ? Y m N D M 7 7 T Y S Y T Z I 7 m N i l G F z a G l s Y S 5 t Y X R o Z X d z
AQAgency.j
[Link]
Only valid values would be passed to [Link] OutdoorAdAAg
[Link]
inStrQueue [Link]
Note: No need to validate the
assumptions
Example: 02:02:30
inStrQueue (Front -> Rear):
{2C 3S AC 9D Joker, 8S 4D QH
outStrStack (Top-> Bottom):
{AC QH, 4D 85 9D 3S
JOKEKgalehLm1hdGhld3M=
2Cjoker JOKER, Joker
I n the above
example, all the card elements that
Front-> Rear). Hence, add the containjoker in inStrQueue areJoker,
Now, the outStrStack (Top->
card to outStrStack in the same order as in the inStrQueue JOKERandjoker in the order they
(Front-> Rear) appear from
Bottom) would
The card elements that contain ranks 2
be
{joker,JOKERJoker
to 10 in the inStrQueue
card to outStrStack in the same order as in the are2C, 3S 9D.8S, 4D (in the order they
inStrQueue (Front -> Rear) appear). Hence, add the
Now, the outStrStack (Top-> Bottom) would be
(4D 85 9D3S 2C. joker JOKER
Next, the card elements that contain
reverse order as in the inStrQueue
Q.A K or Jin the inStrQueue areAC andQH. Jloker) Hence, add the card to outStrStack in the
(Front ->Rear).
Now, the outStrStack (Top-> Bottom) would be (AC¢,
QHO 4D.8S 9DO. 3SÙ, ¢2C%. ¢jokerÙ. JOKER loker
Sample Input and Output:
inStrQueue(FrontRear) outStrStack (Top Bottom)
("8C", "5S", "JOKER", "3H"} "3H", "5S", "8C", "1OKER"}
F"AS", "AC", "10H", "QD") "AS", "AC", "QD", "10H")
("Joker","ac", "KC"} Qc", "KC", "Joker"}
(aD","KH", "20", "105", "joker", "OD", "KH", "IC", "10S", "20",
"IC", "joker" "joker", "joker")
WISH YOU ALL THE BEST
UUmdiDi7TYSYT77mNilGEzaGlsYS5tYXRoZXdz 02:0233
Question [Link] xK [Link] [Link] Tester ava
backage progusingjava;
abstract class AdAgency {
private static int counter = 100;
private static String[] adAvailabilityArr =
("Product", "Service", "Marketing", "Brand")
private client client;
private String adPackage;
private boolean clientCollab;
10 private int totalBillAmount;
11 private String bookingId;
12
I
13 public AdAgency (Client client, String adPackage, boolean
14 [Link] = client;
clientCollab) {
15 [Link] = adPackage;
16 this.c1ientCollab clientCollab;
17
18
19 public Client getClient ()
20 return [Link];
21
22
23 public String getAdPackage () {
24 return [Link];
25
26
27 public boolean getClientCollab ()
28 return this.clientCo1lab;
29
3e
31 public int getTotalBillAmount () {
32 return [Link];
33
35 public String getBookingId ()
36 return [Link]
37
38
39 public static string[] getAdAvailabilityArr(){
40 return AdAgency adAvailabilityArr;
.
41
42
43 public void setTotalBillAmount (int totalBillAmount) {
44 [Link] = totalBillAmount;
45 I
46
47 public void setBookingId (String bookingId) (
48 [Link] = bookingId;
49
5e
51 //To Trainee
52 public void generateBookingId(){
53
54 1/ Implement your logic here
55
56
57
58 //To Trainee
59 public Integer identifywaveOffPercent ()
60 // Implement your logic here
61
62
63 //Change the return statement accordingly
64 return null;
65
66
Reference Question [Link] X [Link] [Link] [Link]
vPROUEC 43 public void setTotalBillAmount (int totalBillAmount) {
QP 44 [Link] =
totalBillAmount;
45
oTrainees
46
47 public void set BookingId (String bookingId) {
dsausingjava 48 [Link] = bookingId;
&[Link] 49
[Link] 5e
[Link] 51 //To Trainee
[Link] 52 public void generateBookingId()
53
vbprogusingjava 54 I
/Implement your logic here
gAdAgencyjava 55
[Link] 56
4OutdoorAdAgencyj 57
[Link] 58 //To Trainee
59 public Integer identifywaveOffPercent () {
60
//Implement your logic here
61
62
63 /Change the return statement accordingly
64 return null
65
66
67 abstract public void calculateTotalBil1();
68
vJAVA DEPENDENCIES
project 9d5fad4c
public elass Client {
private String clientName;
private String adRequirements
private int budget
private String paymentTypes
public Client(String elientName, String adRequirement, int budget,
String paymentType)
[Link] clientNan
11 [Link] adRequirements
[Link] = budget
13 [Link] = paymentTypes
14
15
16 public int getsudget ()
return [Link]
19
2 public String getPayment Type ()
21 return [Link]
22
23
24 public String gettAdRequirement () {
25 return [Link] Requirements
26
27
28 public boolean validateClient () {
29 if ([Link]. length )>=3) {
30 return true
31
32 return false;
33
Run Terminal Exam Help
erence Questiopn [Link] [Link] x [Link] Testerjava
23
24 public String getAdRequirement()
25 return [Link];
26
27
28 public validateClient () {
boolean
29 if ([Link]()>=3) {
30 return true
31
32 return false;
33
34
35 7/To Trainee
validateclientAdRequirement() {
36 public Boolean
37 7/Implement your logic here
38
39 statement accordingly
//Change the return
40
return null
41
42
43
Reference Question [Link] [Link] x
[Link] x
[Link]
23
24 public String getAdRequirement() {
25 return [Link];
26
27
28 public boolean validateClient () {
29 if ([Link]()>=3)
3e return true
31
32 return false;
33
34
35 //To Trainee
36 public Boolean validateClientAdRequirement () {
yj 37 //Implement your logic here
38
39
40 /Change the return statement accordingly
41 return null;
42
43
[Link] x
1erence Question AdAgency java Client java OutdoorAdAgency java
package progusingjava
public class Tester (
Run Debug
public static void main (String[] args) {
Cclient clientob1 = new Client("GoIndia", "service", 5e0000, "Prepaid");
OutdoorAdAgency (clientob1, "Digital", true, "Banner", 6,
588
OutdoorAdAgency adob1 = new
adOb1.calculateTotalBil1();
[Link] println("Booking Id: "+[Link] ()) ;
.
amount: "+[Link] Amount ();
[Link]("Bill
10
11
[Link] [Link]...progusingjava [Link] x [Link] [Link] Tesier
package dsausingjava;
//DO N0T MODIFY THE CODE PROVIDED TO YOU
public class Queue {
private int front, near, maxsize
private Stringl] arrs
Queue (int maxsize) {
10 [Link] maxsize I
11 [Link]
12 [Link] -1
13 [Link] =new String [maxsize]
14
15
16 public int getMaxSize()
17 return [Link],
18
19
20 public boolean isFull(O
21 if (rear maxsize-1)
22 return true
23 return false
24
25
26 public boolean enqueue(String data)
27 if(isFul10)
28 return false;
29 else {
30 arr[t+rear] = data;
31 return true
32
33
VieyCo Ruh
Terminal Exam Help
PLORER Clientjava [Link] [Link]..progusingjava [Link] x
28
[Link] [Link] Testerava
return false
29 else {
OP 30 arr[++rear] data;
Fo Traineos 31 return true
src 32
s dsausingjava 33
[Link] 34
35 public boolean isEmpty(O
[Link]
36 if (front rear)
[Link] 37
[Link]
return tnue I
38 return falses
progusingjava 39
[Link] 40
Clientjava 41 public String dequeue
42 if (isEmpty ())
OutdoorAdAgencyj. 43
[Link] return null
44 else
45 return arr[front++]
46
47
48 public void display ()
49 if (isEmpty ())
50 [Link]("Queue is empty! ");
51 else (
52 [Link]("Displaying Queue elements: ");
53 for (int ind front; ind = rear: ind++)
=
54 [Link](arr[ind ])
55
56
57
PENDENCIES
ject_9d5fad4c
[Link] [Link] [Link]..progusingjava [Link] [Link] xStack. java
1 package dsausingjava;
//DO NOT MODIFY THE cODE PROVIDED TO YOU
Verify
5 public class Solution {
6 public Stack rearrangeDeck (Queue inStrQueue) {
Stack outStrStack = new
Stack ([Link] ());
/ /Implement your logic here
10
11 return outStrStack;
12 I
13
aneyjava Clientjava [Link] [Link]....progusingjava [Link] [Link] [Link] x Testor
package dsausingjava;
//DO NOT MODIFY THE CODE PROVIDED TO You
public class Stack {
private int top
private int maxsize;
private String[1 arr;
10
public Stack(int maxsize) {
11
[Link]-1;
[Link] maxsize; I
13 [Link] new String[maxsize]1:
14
15
16 public int getMaxsize() {
17 return [Link];
18
19
20 public boolean isFull ()
21 if (top = maxsize -1)
22 return true
23 return falses
24
25
26 public boolean push(String data) {
27
if(isFul1())
28 return false;
29 else {
30 arr[++top] = data;
31 return true;
32
33
public boolean isEmpty()
if (top < e)
B7 return true
return false;
39
4e
41 public String peek () {
42 if (isEmpty ())
43 return null;
44 return arr[top] ; I
45
46
47 public String pop() {
48 if (isEmpty())
49 return null;
Se return arr [top - -1;
51
52
public void display () {
54 if (isEmpty ())
55 [Link]( "Stack is empty! ");
S6 else {
57 [Link] ("DisplayingStack elements : ");
58 for (int ind = top; ind =0; ind--)
59 [Link] (arr[ind]);
6e
61
62
63
Cient java [Link] [Link]...Jprogusingjava [Link] [Link] [Link]
package dsausingjava [Link] Jdsa
public class Tester {
Run | Debug
public static void main (String[] args) {
Solution ob new
Solution ( )
Queue inStrQueue new
=
Queue (10)
[Link] ("2C") ;
[Link]("3S" )
[Link] ("AC");
10 [Link] ( "9D" )5
11 [Link] ("Joker ");
12 [Link]("8S");
13 [Link]("4D")5
14 [Link]("QH");
15 [Link]("3OKER") ;
16 [Link]("joker") 5
17
Stack outStrStack [Link](inStrQueue);
18
[Link]()5
19
20
21
LF UTE-8 Spaces4
NjIGFzaGlsYS5tYXRoZXdz
01:57:52 Ln 1,Col 1
DliA?NDM5MTUWM2VmNDMzZTYSYTZjZm