Question: Question: Where is the error in my code? I can't seem to figure that out.Please advise and point out the mistake and also provide me

Question:Where is the error in my code? I can't seem to figure that out.Please advise and point out the mistake and also provide me a solution here with my work.

It's not compiling.

Here are my codes:

Deck.java

Card.java

CardTable.java

demo.java

I am compiling them in different files. They can't be all together. That's the condition of this exercise.

Question:Where is the error in my code? I can't seem to figurethat out.Please advise and point out the mistake and also provide mea solution here with my work. It's not compiling. Here are mycodes:Deck.javaCard.javaCardTable.javademo.java I am compiling them in different files. They can't be alltogether. That's the condition of this exercise. \f\fint n = o; HWhiol'Icard. int xPos = t]; it\" Where it should be pissed initially.int yPos = t]; if... Fleacl in the cards using particular iilename conventions. if Images fer the backs and Jokers are ignored here.Stn'ng suits = "shoe"; String faoes = "aEmETtjqk"; for [int suit=D; suitv: suits.length; suit++}{ for [int faced}: face i: faoesJeng'I; iaoe++] { if...Get the image from the images suodireotoryt String imageF'ath = "oardsmagesf' +

\f\fint n = o; HWhiol'I card. int xPos = t]; it\" Where it should be pissed initially. int yPos = t]; if... Fleacl in the cards using particular iile name conventions. if Images fer the backs and Jokers are ignored here. Stn'ng suits = "shoe"; String faoes = "aEmETtjqk"; for [int suit=D; suit v: suits.length; suit++}{ for [int faced}: face i: faoesJeng'I; iaoe++] { if... Get the image from the images suodireotoryt String imageF'ath = "oardsmagesf' + faoesehamtaoe} + suits.oharAt[suit1 + ".gii"; UFtL imageUFlL = oldrgetFtesouroteirnagePath]; lrnageloon irng = new Imageloon{imageUFlL]; ll... Create a card and add it to the deck. Card card = new Cartiijmgl; oardmoveToixPos. yF'os}; _I:Ieolr[n] = card; if... Update looal were for next card. xPos += 5; yPos += 4; n-H-; HWWH CardTahle.]ava package cards; import javaawlf; import javaawt.evant.*; import javax.sv.ring.*; rrrrm:rrrrrm:rrrrrm:rrrrvs:rrrrvs:rrrrrrrrmmrrrmmrrr CardT able public class GardTable extends JGomponent implements MousaListener. Mouselvlotion Ustaner{ ff--_________-______--______--_____--______--______--_____---______--______--______--=_-= constants private static final Color BACKGFIDUND_CDLDH = ColorFlEEN; private static final int TABLE_SIEE = 4m); ff Pixels. If: _____- ______-- ______-- _____- ______-- ______-- _____- ______- ______-- ______-- =____--= fields ff... Initial image coords. private int _initJIf = D; H x coord - set from drag private int _init'r' = o; #1; coord - set from drag ff... Position in image of mouse press to make dragging looI-c better. private int _dragFromJ{ = D; ff Displacement inside image of mouse press. private int _dragFrom'r' = 0; private Gard _dec|-t; ff Should reallyr be in a model, but private Gard _currentCard = null; If Current selected card. Hg==mmmmmmmmm= EDI'EtMB'tDr public CardTahlteGard deck] { _declt = deck; If Should he passed a model. ff... Initialize graphics setPreferredSiztenew DimensionfTABLE_SlZE, TABLE_SlZEl); setBackgroundfGolorJalue}; It... Add mouse listeners. addMouseListenerIjthis]; addMouseMotionListenerlthis]; } l.y:___________________--___________-____________-__== p'ntcomponent @Gyerride public void paintomponentBraphios g}{ It... Paint baokground int width = get'Width; int height = getHeight; g.setColortBACKGHDUND_CDLDFt]; g.tillFleot{D. , width. height); H... Display the cards. starting with the first array element. It The array order defines the z-axis depth. for [Gard o :_deo|-tj{ o.draw[g. this); It } Hg$mm%mm==mr_== I'I'I'tl'm I'I'IDUSEPI'ESEBd it\" Check to see if press is within any card. It If it is, It * Set Hourrentard so mouseDragged knows what to drag. It * Fteoord where in the image [relative to the upper left ooordinates] If the mouse was oliolted, because it looks best it we drag from there. It TODD: Move the card to the last position so that it displays on top. public void mousePressedtMotaeEyent e] { int x = e.getX[}; It Says the x ooord of the oliok int y = e.getY[}: 4"! Save the y ooord of the slick it\"... Find card image this is in. Check from top down. _currentCard = null; if Assume net in an}:' image. fer [int crd=_deck.length-1 ; crdn; crd} { Card testGard = _decl~:[crd]: it {testCard.ccntsins{x. 1m { if... Feund. remember this card for dragging. _dragFrcm}t = I - teethrdgetK; .I'i' how far from left _dragFrch = x - testCardgetY; H hcw tar tram tep _currentCard = testard; I! Ftemember what we're dragging. break; if Step when we find the first match. } } } figmmm%m=g%mmm nmuseDragged #Setx,1.r to mouse position and repaint. public 1urn-id meuseDraggenduseEvent e}{ if LsurrentGard != null} { n" Nan-null ii pressed inside card image. int new}: = e.get){[} - _dragFrnm}t; int new'f = e.get"f{] - _dregFrem'r'; iii- Den't move the image etl the screen sides new}: = Math.max{new}t. }; new}: = Math.min(new)(. getWidthi} - _currentCard.get"Jii'idth{]): iii- Den't move the image c tcp dr buttem new? = Math.max[new'r". it]; new\":' = Math.min[new't'. getHeight{] - _currentGerd.getHeight[}j|; _currentl3ard.mever{newx. newY}; this.repeint; H Ftepeint because p-csitien changed. } i ii Turn off dragging it mouse exits penel. public void mouseExitedv'louseEvent e){ _ourrenthrd = null; } ffgrgmm$mm======= IQI'IDI'E Either ITIDLISB EVE-n15. public void mouselvloved {MouseEvent e) -[} ii ignore these events public void momeEnterediMouseEvent e} {} if ignore these events public void mouseClioked-{MouseEvent e) -[} i'i' ignore these events public void mouseFteieesediMouseEvent e] {} ii ignore these events } \fQacxage C I-WIK 1"; L.' HSBIgllIIIEIIl 3 I' H Ell H -.l_.J import j IDeckJava import j Default Extension HUM/H DemoGUI class Car Format _ ____. Q Binanr I Unix lds .4; : Directory "[Users[rawanrafanlDesktop/Assignment 3" does not match package structure of Java file. Save as "lUsers/rawanrafan{Desktop/Assignment 3/cardsiCardDem01Java"? ' File ame: ICardDemolJava -:ca. \fI Deckjava Q I Elm Default Extension // Card 11:15 import j import j HUN/H class Car //::::::: PFyePe I L; Directory "lUsersIrawanrafan[Desktop/Assignment 3" Format .. ti) Einanr I Unix '-; 43' -':l -_. does not match package structure ofJava file. Save as "jUsersIrawanrafan[Desktop/Assignment 3lcards/Cardjava"? .1 File ame: ICardJava -: cancel

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!