Program but need help working
I have this program done but when I try to run it wouldnt work
What I have to create to make it work
Thanks
import java.awt.Graphics;
import java.awt.Color;
public class Building
private final int DEFAULT_WIDTH = 50;
private final int DEFAULT_HEIGHT = 100;
private final int DEFAULT_WINDOWS = 5;
private final int WINDOW_SIZE = 5;
private int width, height, windows;
// Sets up this Building based on default values.
public Building ()
width = DEFAULT_WIDTH;
height = DEFAULT_HEIGHT;
// Constructor: Sets this Building's size.
public Building (int buildingWidth, int buildingHeight)
width = buildingWidth;
height = buildingHeight;
// Returns the width of this building.
public int getWidth ()
return width;
// Draws the building.
public void draw (Graphics page, int leftedge, int bottom)
int winX, winY;
int top = bottom - height;
page.setColor (Color.black);
page.fillRect (leftedge, top, width, height);
// Draw three windows in random locations
page.setColor (Color.yellow);
winX = leftedge + (int) (Math.random() * (width-WINDOW_SIZE));
winY = top + (int) (Math.random() * (height-WINDOW_SIZE));
page.fillRect (winX, winY, WINDOW_SIZE, WINDOW_SIZE);
winX = leftedge + (int) (Math.random() * (width-WINDOW_SIZE));
winY = top + (int) (Math.random() * (height-WINDOW_SIZE));
page.fillRect (winX, winY, WINDOW_SIZE, WINDOW_SIZE);
winX = leftedge + (int) (Math.random() * (width-WINDOW_SIZE));
winY = top + (int) (Math.random() * (height-WINDOW_SIZE));
page.fillRect (winX, winY, WINDOW_SIZE, WINDOW_SIZE);
}
HI, This might work.
publi class Building{
public static void main(String args[]){new Building1();}
class Building1
private final int DEFAULT_WIDTH = 50;
private final int DEFAULT_HEIGHT = 100;
private final int DEFAULT_WINDOWS = 5;
private final int WINDOW_SIZE = 5;
private int width, height, windows;
// Sets up this Building based on default values.
public Building ()
width = DEFAULT_WIDTH;
height = DEFAULT_HEIGHT;
// Constructor: Sets this Building's size.
public Building (int buildingWidth, int buildingHeight)
width = buildingWidth;
height = buildingHeight;
// Returns the width of this building.
public int getWidth ()
return width;
// Draws the building.
public void draw (Graphics page, int leftedge, int bottom)
int winX, winY;
int top = bottom - height;
page.setColor (Color.black);
page.fillRect (leftedge, top, width, height);
// Draw three windows in random locations
page.setColor (Color.yellow);
winX = leftedge + (int) (Math.random() * (width-WINDOW_SIZE));
winY = top + (int) (Math.random() * (height-WINDOW_SIZE));
page.fillRect (winX, winY, WINDOW_SIZE, WINDOW_SIZE);
winX = leftedge + (int) (Math.random() * (width-WINDOW_SIZE));
winY = top + (int) (Math.random() * (height-WINDOW_SIZE));
page.fillRect (winX, winY, WINDOW_SIZE, WINDOW_SIZE);
winX = leftedge + (int) (Math.random() * (width-WINDOW_SIZE));
winY = top + (int) (Math.random() * (height-WINDOW_SIZE));
page.fillRect (winX, winY, WINDOW_SIZE, WINDOW_SIZE);
}
Similar Messages
-
i have problem with firefox , it wont loud , the dose not come up , and it frizzes ? i even re-install the program but it wont work:( any suggestion would be helpful , thanks
i cant login anywhere as all my passwords are saved in firefox, i cant even access teh firefox preference to get my password, it's so sadYou likley have a corrupted Firefox preference or other support file in your User/Library folder.
Programs load these files from the user account to adjust to user specifications, instead of having multiple copies of the same program on the machine.
So when you reinstalled Firefox, it reinstalled the progrma only and the user support files remained from before.
To prove this point, use System Preferences to create another Admin account and log into it, Firefox should run like a charm.
To remove the Firefox support files from the problem user account your going to need to locate these files and delete them one at a time and try FF again and again.
The first one you shoull try is your FF .plist file located in your User/Library folder.
Clicm on the Finder and use the Go > Go to Folder and paste this
~/Library/Preferences
and press Go.
Now scroll down until you see the Firefox or Mozilla .plist file and Trash it, quit and restart Firefox, it will recreate the preference file with default settings you will have to reset it.
Next run through the list of fixes #1-13 here before proceeding.
https://discussions.apple.com/docs/DOC-3353
If you need help deleting other FF files, download the free Easy Find from MacUpdate.com and search for anything "Mozilla" or "Firefox" in your User account only and take your chances you hopefully won't delete your password file in the process.
You should have site passwords written down someplace and locked up tightin case you need them, a computer isn't totally safe and reliable. -
I am new to this but need help. Lion and iCloud have never worked on my desk top or MacBook Pro. Slow or Stop! Is there any way to fix the problem?
We need more information. I'm not sure what you mean by both Lion and iCloud have never worked.
-
I am un able to send mail as it gets stuck in my outbox. This is a recent phenomena. I am sure the solution is simple but need help?
I looked everywhere for a solution - and I finally figured it out! Deleting my accounts didn't work, but here is what worked. This worked when my Gmail accounts were not sending properly. I'm not sure if it works for other e-mail services.
1. While in Mac Mail, click "Mail" in the top left corner of the screen
2. Click "Preferences"
3. Click "Accounts"
4. Select your account that isn't sending properly
5. In "Outgoing Mail Server (SMTP)" there will be two options - Gmail & Gmail (offline)
Make sure that "Gmail" is selected and NOT "Gmail (offline)"
If you navigate to another section in Preferences, it will ask you to SAVE - make sure you save your changes!
It worked for me, hope it works for you! -
Ok so I have a free standing iSight Cam, is it possible to use it with my white MacBook ? and if so how do I go about it ? I've tried researching for updates, drives but need help. Can someone give me some direction ?
jpatricio787 wrote: ... is it possible to use it with my white MacBook ?...
OK so yes, but if, and only if:
(1) your MacBook has a Firewire port (not all do)
- and -
(2) your old external iSight camera works (not all do)
- and -
(3) your MacBook is working properly.
If you are not certain whether your MacBook model has Firewire, you can search MacBook Technical Specifications for your model. Alternatively, check the User Guide Manual that came with your MacBook for the information you need to be certain.
If you are not certain that your old external iSight camera works, you can test it using the suggestions in this link.
jpatricio787 wrote: ... if so how do I go about it ? ...
Follow the instructions in your iSight User's Guide to connect and turn on the iSight. Then launch the Apple app you want to use with your iSight. If you need more information about using an app, search for "camera" (without the quote marks) in the Help menu choice for the app.
jpatricio787 wrote:... Can someone give me some direction ?
If you need more direction, post back the specifics of what you still need. We will offer further direction based on the details of your reply.
Message was edited by: EZ Jim
Mac OSX 10.9.3 -
I am trying to trigger a custom event using a program but does not work ..
HI ....i am trying to trigger a custom event of a custom object type using a program but does not work. If trigger the same event using SWUE it works.
below is the code...
{Key = '0010001115'. "Sales Order Number (hard-coded)
CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
objtype = 'ZXXXXXXXF'
objkey = KEY
event = 'ZEVENT'
CREATOR = ' '
TAKE_WORKITEM_REQUESTER = ' '
START_WITH_DELAY = ' '
START_RECFB_SYNCHRON = ' '
NO_COMMIT_FOR_QUEUE = ' '
DEBUG_FLAG = ' '
NO_LOGGING = ' '
IDENT =
IMPORTING
EVENT_ID =
RECEIVER_COUNT =
TABLES
EVENT_CONTAINER =
EXCEPTIONS
OBJTYPE_NOT_FOUND = 1
OTHERS = 2}
Please guide me if i am missing something.Hi Sunny,
I think you should try creating the event using FM SAP_WAPI_CREATE_EVENT.
CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'
EXPORTING
OBJECT_TYPE = 'ZXXXXXXXF'
OBJECT_KEY = key
EVENT = 'ZEVENT'
* COMMIT_WORK = 'X'
* EVENT_LANGUAGE = SY-LANGU
* LANGUAGE = SY-LANGU
* USER = SY-UNAME
* IFS_XML_CONTAINER =
IMPORTING
RETURN_CODE = rcode
EVENT_ID = event_id
* TABLES
* INPUT_CONTAINER =
* MESSAGE_LINES =
* MESSAGE_STRUCT =
Regards,
Saumya -
Need help with Itunes transferrs and can I use my Edge phone as a router?
I'm not a tech person, but need help with my Itunes account in transferring money and downloads onto new phone
Is this an iPhone?
Set it up using the AppleID you used on the previous iPhone. -
Purchasing MBA but need help on upgrades.
Hello, I am purchasing an MBA, but need help on upgrades based on the following; I will be attending medical school in the fall, I take a wide range of photos of my family on my iPhone that I play with on certain apps and do store them in the cloud and computer, I have a medium iTunes libaray but will get bigger with the additional apps for school, I am a moderate gamer (I play games online as well as my kids do, but nothing that will take up a ton of space when downloaded like Assassins Creed) and I plan on running MS Office. I've already decided to upgrade to the 8GB but I can't decide if I should upgrade to the 512GB Flash or stay with the 256GB and upgrade from the i5 to i7 or stick with it. I don't plan on buying another until I graduate. I am new to the Mac World outside of the use of my iPhone which convience me to convert from my awful PC. Can you MBA experts relay some advice on a good route. I appreciate it, Thanks
My rule of thumb is to buy the largest drive storage available. Especially since the Air models can't be upgraded to a larger size in the future. I also like to buy the most amount of RAM offer and as with the storage space on the Air models can't be upgraded once purchased. So Bite the Bullet and spend the money to get both the most RAM and the largest storage offered as neither can be increased later on. Also I suggest you spend the extra money on the Applecare extended warranty because to fix any Mac once the standard warranty is over is very expensive. You have until the one year standard warranty runs out to buy the Applecare extended warranty.
-
All of my photos are displayed as BW because somehow I've saved a quick develop preset and it saves as BW. This is for all of my photos. I can individually undo them but need help in how to get rid of the preset so all photos goes to Default or as shot. thanks
Go to the develop module and highlight all of the images in the filmstrip at the bottom of the screen. Then activate Auto-sync and click on the Reset button. That should reset all of the images to your camera default settings.
-
Error at new statement on extended program check need help
Hi all ,
This is the code :
LOOP AT i_stocks INTO wa_stocks WHERE NOT pulkt IS INITIAL AND
NOT bstkt IS INITIAL AND
NOT fprctr IS INITIAL AND
( write_off_fix <> 0 OR
write_off_pup <> 0 ).
AT NEW fprctr.
CLEAR: l_prctrsum_fix, l_prctrsum_pup.
ENDAT.
IF wa_stocks-bukrs <> lastbukrs.
lastbukrs = wa_stocks-bukrs.
PERFORM document_header USING xreversal.
i_counter = 1.
CLEAR lastkostl.
ENDIF.
ADD wa_stocks-write_off_pup TO l_prctrsum_pup.
ENDLOOP
On Extended program check its says :
The LOOP statement processing will be limited
(FROM, TO and WHERE additions in LOOP)
Interaction with group change processing (AT NEW, ...) is undefined
(The message can be hidden with "#EC *)
It means at statement AT NEW fprctr .
Need help , How can i resolve this error ?
Regards .
Edited by: ujjwal dharmak on Feb 19, 2010 9:55 AM
Moderator message - Moved to the correct forum
Edited by: Rob Burbank on Feb 19, 2010 9:04 AMSince you are using where condition in loop statement and also using the control break statement thats why it is showing the error for you.
So if you want you can do like this
loop at itab into wa.
if not wa-f1 is initial ....<and other conditions>.
continue.
endif.
at new f1.
endat.
endloop.
It will resolve your problem but I am having the doubt how the at new will work properly...
Regards
Shiba Prasad Dutta -
Getting a new iMac - overwhelmed w info here but need help
Hi,
I'm getting a new iMac next week and need help with Blackberry Bold 9000 issues and syncing with iCal, etc on the machine. I have been told that I can buy an app for about $30 that will sync the BB with the mac programs but reading here, I am confused - are some of the posts here and the KB notes related to syncing directly with the mac software or are they only for making a separate BB desktop for the mac?
I have looked at several of the KB notes but I haven't found the answer yet.
thanks.
marcelcat
Bold 9000 owner since Feb 2009What’s the difference between:
8GB 1066MHz DDR3 SDRAM - 4x2GB http://Add $200.00...
(from 4GB 1066MHz DDR3 SDRAM - 2x2GB)
and
8GB 1066MHz DDR3 SDRAM - 2x4GB http://Add $600.00
4GB DIMMs are at present significantly more expensive than 2GB DIMMs. It's your choice whether to pay the extra money and have empty slots available for additional future memory expansion (without removing any existing memory).
I presume 2.8GHz Quad-Core Intel i7 is bigger, or more powerful than the 3.33GHz Intel Core 2 Duo of the 21.5” iMac model. Correct?
Generally yes. You can see benchmarks on places like Barefeats if you want to see comparison numbers.
it appears the CD/DVD problem thing is not evident in the 27” model as it at least was in the 21.5” model. Right?
I can't add anything to what I said on the subject previously.
cracked screens upon opening the box of the new computer, were much more of a problem for the bigger, 27” models that the 21.5” models. Hopefully, Apple has taken care of that by packaging them more carefully.
I haven't seen a report of any cracked screens in several weeks now. But with the gorillas the shipping companies tend to use, there are no guarantees. I once received a pallet-load of computers that the trucking company had driven a forklift blade through. So you never know how your computer might arrive. The prevalence of problems seems to have been alleviated, though.
Regards. -
Really, really easy but need help
This question is very easy but I just began java and I need help. I need to write a simple program to display an invoice with item name, number, quantity, and price. I am going to use two classes but I can't figure out how to create instances to make the items display. Can anyone help?
here you go, hope the following code helps
public class InvoiceTest
public static void main(String[] args)
Invoice in = new Invoice("375ml fanta", 1234, 10, 1.5);
System.out.println(in.toString());
public class Invoice
private String itemName;
private int itemNumber;
private int quantity;
private double price;
private double totalPrice;
public Invoice(String name, int num, int qua, double price)
itemName = name;
itemNumber = num;
quantity = qua;
this.price = price;
public String getItemName()
return itemName;
public int getItemNumber()
return itemNumber;
public int getQuantity()
return quantity;
public double getPrice()
return price;
public double getTotalPrice()
totalPrice = (double)(price * quantity);
return totalPrice;
public String toString()
return "invoice detail: \n"
+ "item name: " + getItemName() + "\n"
+ "item number: " + getItemNumber() + "\n"
+ "quantity: " + getQuantity() + "\n"
+ "price:" + getPrice() + "\n"
+ "total price: " + getTotalPrice();
} -
I need a Rich Text Editor so I'm making one but need help.
Hi all,
I'm still figuring out the TLF and how it works so my question might seem dumb to some but any help would be great.
I'm making a RTE because I need access to a TextFlow when the user is done editing the text. It wasn't obviouse that the halo RTE could do that so I'm making my own.
The problem I'm running in to is that a user can select a range of text and apply something like italics to it. But if they don't have a range selected, say for example they just want to start off typing in italics, then how would I do that?
I've tried doing this and it works for a range but not anything else
var textfmt:TextLayoutFormat = rte.getFormatOfRange(null, rte.selectionAnchorPosition, rte.selectionActivePosition);
textfmt.fontStyle = (textfmt.fontStyle == FontPosture.ITALIC) ? FontPosture.NORMAL : FontPosture.ITALIC;
rte.setFormatOfRange(textfmt, rte.selectionAnchorPosition, rte.selectionActivePosition);
I also tried this when there wasn't a range selected and it also didn't work
var f:TextLayoutFormat = new TextLayoutFormat();
f.fontStyle = FontPosture.ITALIC;
IEditManager(rte.textFlow.interactionManager).applyContainerFormat(f);
Any help would be great.
Thanks.Never mind, I did the following and things worked for me.
if (rte.textFlow && rte.textFlow.interactionManager is IEditManager)
var f:TextLayoutFormat = new TextLayoutFormat();
f.fontStyle = (italics.selected) ? FontPosture.ITALIC : FontPosture.NORMAL;
IEditManager(rte.textFlow.interactionManager).applyFormat(f, null, f, null);
If you want to add anything or explain anything I would appreciate that. -
Hi,
I spent the better part of this morning finding Adobe/Photoshop elements 11 tutorials. I wanted to try changing faces on group pictures. I downloaded what I thought would work. Now I need help finding out if this "elements 11" is included with what I downloaded so that I may try to use this feature. Please talk to me about this.First of all, this is the Photoshop forum, not the Photoshop Elements forum:
Photoshop Elements
Second, the version currently available from Adobe is Photoshop Elements 12.
What did you download, and where did you download it from? -
K330 Motherboard replaced but need help.
I got the motherboard replaced from the recall. But the problem is the tech did not put in the Model # and serial on the motherboard. Is there any motherboard manuals that might tell me if the specs have been upgraded etc??
From CPU-Z:
DMI BIOS
vendor LENOVO
version DKKT20AUS
date 03/16/2011
DMI System Information
manufacturer LENOVO
product INVALID
version Lenovo Product
serial INVALID
UUID {FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF}
DMI Baseboard
vendor LENOVO
model To be filled by O.E.M.
revision To be filled by O.E.M.
serial INVALID
DMI System Enclosure
manufacturer To Be Filled By O.E.M.
chassis type Desktop
chassis serial INVALID
DMI Processor
manufacturer Intel
model Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
clock speed 3400.0 MHz
FSB speed 100.0 MHz
multiplier 34.0x
DMI Port Connector
designation J1A1 (internal)
designation PS2Mouse (external)
port type Mouse Port
connector PS/2
DMI Port Connector
designation J1A1 (internal)
designation Keyboard (external)
port type Keyboard Port
connector PS/2
DMI Port Connector
designation J2A1 (internal)
designation TV Out (external)
connector Mini Centronics Type-14
DMI Port Connector
designation J2A2A (internal)
designation COM A (external)
port type Serial Port 16550A
connector DB-9 male
DMI Port Connector
designation J2A2B (internal)
designation Video (external)
port type Video Port
connector DB-15 female
DMI Port Connector
designation J3A1 (internal)
designation USB1 (external)
port type USB
connector Access Bus (USB)
DMI Port Connector
designation J3A1 (internal)
designation USB2 (external)
port type USB
connector Access Bus (USB)
DMI Port Connector
designation J3A1 (internal)
designation USB3 (external)
port type USB
connector Access Bus (USB)
DMI Port Connector
designation J9A1 - TPM HDR (internal)
DMI Port Connector
designation J9C1 - PCIE DOCKING CONN (internal)
DMI Port Connector
designation J2B3 - CPU FAN (internal)
DMI Port Connector
designation J6C2 - EXT HDMI (internal)
DMI Port Connector
designation J3C1 - GMCH FAN (internal)
DMI Port Connector
designation J1D1 - ITP (internal)
DMI Port Connector
designation J9E2 - MDC INTPSR (internal)
DMI Port Connector
designation J9E4 - MDC INTPSR (internal)
DMI Port Connector
designation J9E3 - LPC HOT DOCKING (internal)
DMI Port Connector
designation J9E1 - SCAN MATRIX (internal)
DMI Port Connector
designation J9G1 - LPC SIDE BAND (internal)
DMI Port Connector
designation J8F1 - UNIFIED (internal)
DMI Port Connector
designation J6F1 - LVDS (internal)
DMI Port Connector
designation J2F1 - LAI FAN (internal)
DMI Port Connector
designation J2G1 - GFX VID (internal)
DMI Port Connector
designation J1G6 - AC JACK (internal)
DMI Extension Slot
designation J6B2
type A5
populated yes
DMI Extension Slot
designation J6B1
type A5
populated no
DMI Extension Slot
designation J6D1
type A5
populated no
DMI Extension Slot
designation J7B1
type A5
populated no
DMI Extension Slot
designation J8B4
type A5
populated no
DMI OEM Strings
string[0] DK20A
DMI Physical Memory Array
location Motherboard
usage System Memory
correction None
max capacity 32768 MBytes
max# of devices 4
DMI Memory Device
designation A1_DIMM0
format DIMM
type unknown
total width 64 bits
data width 64 bits
size 4096 MBytes
DMI Memory Device
designation A1_DIMM1
format DIMM
type unknown
total width 64 bits
data width 64 bits
size 4096 MBytes
DMI Memory Device
designation A1_DIMM2
format DIMM
type unknown
total width 64 bits
data width 64 bits
DMI Memory Device
designation A1_DIMM3
format DIMM
type unknown
total width 64 bits
data width 64 bits
size 4096 MByteshey skimore,
i would suggest to cross reference with your current setup with this >>
http://www.lenovo.com/psref/pdf/icbook.pdf
WW Social Media
Important Note: If you need help, post your question in the forum, and include your system type, model number and OS. Do not post your serial number.
Did someone help you today? Press the star on the left to thank them with a Kudo!
If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"!
Follow @LenovoForums on Twitter!
Have you checked out the Community Knowledgebase yet?!
How to send a private message? --> Check out this article.
Maybe you are looking for
-
Can't use gmail in Safari - can get mail but not send or reply
I can't send or reply to emails in gmail when using Safari? Only get error message that it was "unsuccessful and try again." But then can't even delete it or close it out - just keeps going back to that same error message. Have to quit gmail to get i
-
Macbook Pro will not boot up - can't access HD in target mode
I am fairly new to Mac's, so I greatly appreciate the help in advance.... Quick synopsis of problem: Was using my new Macbook Pro, purchased 6 mos. ago... only had Safari open, Closed lid, went to dinner...when i came back, opened the lid... would
-
JMS Adapter: Sending data with WebSphere MQ Client to XI
Hi, I want to send data from the WebSphere MQ Client to the XI. Is this possible and what do I have to do except configuring the JMS queues in Visual admin? Thanks in advance Dominic
-
hey guys, i have a simple question. What is the difference between flash pro version 8 and flash mx pro 2004 version 7 i have the flash mx pro 2004 v.7 , but i heard the flash "no mx" pro v.8 is better. is that thru ? and can i do same thing with v8
-
I see that iDVD8 indicates higher resolution pictures can be used. What is the limit for iDVD6 ? I can not seem to locate the information or just looking/searching incorrectly.