Help needed with this assignment
Heres the question i have to complete.
Build a new class LotsOfBooks which has an attribute which is an array of Book objects and initialises this array using a constructor method parameter. Write a method "setAllReserved" in LotsOfBooks which invokes setReserved( ) on all the books in the array.
I have to submit my code into a Java compiler that tests my code against the teachers, if it is wrong you get given an error message. My code compiles fine in the compiler Blue J, but in the online tester i get this message.
mismatch in setAllReserved
Sometimes if i jig things about i get a null pointer error in the tester. I do not nesserseraly want a written java answer, just to know what i am doing wrong and what i can change.
NB The array does not have to have any values and the Book class was already given.
public class LotsOfBooks
private Book[] books;
public LotsOfBooks(Object Book[])
public void setAllReserved()
for (int i=0; i<books.length; i++){
Book b =books;
b.setReserved();
public class Book
String author;
String title;
boolean reserved;
boolean onLoan;
public Book(String author, String title){
this.author = author;
this.title = title;
reserved = false;
onLoan = false;
public void setReserved(){
reserved = true;
public void setOnLoan(){
onLoan = true;
public boolean isOnLoan(){
return onLoan;
public String getAuthor(){
return author;
well for the preferred on i get
DataSet 1
----------Compilation output--------------------------------------
javac BookTester1.java
BookTester1.java:18: cannot resolve symbol
symbol : constructor LotsOfBooks (Book[])
location: class LotsOfBooks
LotsOfBooks lob = new LotsOfBooks(books);
^
1 error
----------Sorry expected answer was-------------------------------
The method setAllReserved worked OK - well done
----------Your answer however was---------------------------------
++ ERROR ++
Your program did not compile
Scroll back in this window to find more details
[S] Sorry exercise ci101/Wk12BookA was not completed successfully
and for if not i get
DataSet 1
----------Compilation output--------------------------------------
javac BookTester1.java
----------Sorry expected answer was-------------------------------
The method setAllReserved worked OK - well done
----------Your answer however was---------------------------------
Exception in thread "main" java.lang.ClassCastException
at LotsOfBooks.<init>(LotsOfBooks.java:6)
at BookTester1.main(BookTester1.java:18)
[S] Sorry exercise ci101/Wk12BookA was not completed successfully
Similar Messages
-
can anyone out there help me with this assignment ????? i`ll attach the file to this topic
In this assignment, you are to write a Java applet, using arrays, to simulate the functions of a drinks-vending machine.
The assignment requirements described below are broken down into 2 stages of development, described in this document
as 'Basic Requirements' and 'Additional Features'. You are advised to do your programming progressively in these
stages. An Activity Plan has also been specified for you to follow. Refer to the 'Grading Criteria' on page 5 to have
an idea of how the different components are graded.
1. 1. BACKGROUND
A company intends to build computerised drinks-vending machines to enlarge its business portfolio. You have been tasked to develop a
Java applet that simulates the operation of such a machine to determine if it will meet their needs.
2. 1. BASIC REQUIREMENTS
The machine should have a wide range of drinks available. A customer can choose a drink according to the following criteria:
a) a) Category of Drinks
� � Beverages
� � Soft Drinks
(For beverages, there is choice of whether sugar and/or creamer is required, for which there is an additional charge.)
b) b) Type of Beverages
� � Hot
� � Cold
Once a customer has specified the drink he wants, the amount payable is displayed. The unit prices to be displayed are as follows:
Drinks Price per Cup/Packet ($)
Beverage: Coffee 1.00
Tea 1.20
Milo 1.40
Horlicks 1.35
Chrysanthemum 1.00
Ginger 0.80
Soft Drinks: Apple 1.40
Orange 1.40
Pineapple 1.50
Carrot 2.00
Longan 1.20
Bandung 1.00
(For beverages, a request for sugar or creamer attracts an additional charge of $0.10 each. Creamer is not applicable for
chrysanthemum and ginger.)
The customer may then confirm his order by entering the amount payable (this symbolises his payment for the drink). Whenever the
payment input is not correct, an appropriate error message is displayed, whereupon the customer has to re-enter the amount again.
When the correct amount is paid, the required drink is dispensed.
For any drink that is out of stock, a message is shown, stating that it is not available. Each time a drink is dispensed, the stock for that
drink is updated (For beverages, the stock is stored in units of servings for each cup.) To simplify the testing, you may start the simulation
by setting the stock for each drink to 10 packets or cup-servings.
3. 2. ADDITIONAL FEATURES
In addition, the simulator can have the following features:
a) a) Smart Graphical User-Interface (GUI)
You may build upon the basic requirements by recommending alternative drinks of the same category, whenever a requested
drink is not available (as signified from the stock). In this case, only drinks which are available (i.e., in sufficient stock) are
displayed for the customer to choose. And if only soft drinks are available, the selections for creamer and sugar should be disabled.
b) b) Multiple Orders
A customer could order more than one drink. The system could allow him to specify as many drinks as he wants, prompting him
for an appropriate payment, and then dispensing the drinks accordingly, subject to availability. This may also entail the extension
of the graphical user-interface.
c) c) Sales Analysis
Periodically, the total revenue accumulated since the last collection is printed in descending order of sales for each drink sold,
together with a grand total. The cash is then cleared from the machine. This feature requires password-protection.
d) d) Replenishment of Stock
Periodically, the stock is checked to determine how much of each drink needs to be replenished. For this purpose, a list of the
drinks with the corresponding quantity on hand is printed in ascending order of stock level. Drinks with insufficient stock are
topped up to a level of 10 servings or packets. This feature also requires password-protection.
e) e) Any other relevant features
You are limited only by your creativity. You can add any other relevant features for this project. Please consult your tutor before
you proceed.
To qualify for the full marks for this section, you need to implement 2 features, at least one of which must be either (a) or (b) above.
4. 3. ACTIVITY PLAN
Suggestions for Getting Started
There are many ways that you could complete this assignment. The most important part is to think about the entire project first so that
it is easy to integrate the various pieces. You should also consider what type of graphics you want to incorporate.
a) a) Analysis
1. Understand the program specification and the requirements before attempting the project.
b) b) Program Design
2. Work out the GUI components (e.g., TextFields, CheckBoxes, ChoiceBoxes, Buttons, etc.) needed to get the user input.
3. 3. Work out the main logic of the program using modular programming techniques; i.e. use methods appropriately. E.g., tasks that perform
4. 4. a well-defined function or those that are repeated should be coded as methods. For example, you can write the methods, displayBill(),
5. 5. makePayment(), computeTotal(), dispenseDrink(), etc. You need to think carefully about the return type and the parameters of each
6. 6. method.
7. 7. You are required to use arrays appropriately for this assignment. Marks will be deducted for inefficient use or non-usage of arrays.
c) Implementation & Testing
8. 8. Write the method definition of each method ONE at a time.
9. 9. Test your program logic to make sure that it works. In the interim, you can use �g.drawString(�);� or �System.out.println(�);� to print
10. 10. out intermediate results so that you can see whether your program is working correctly. You may not want to bother about error-checking
11. 11. at this point. You should test each method as soon as it is written, as it is much easier to debug your program in this way.
5. 4. DELIVERABLES
By Monday, 25th February before 5:00 p.m., hand in the following to the School of ICT Administrative Office at Block 31, level 8:
� � A copy of the printout of your .java file.
� � A diskette labelled with your name, group, student ID. The diskette should contain ALL the necessary files (.java, .html, and .class)
to run your applet.
� � The above in an envelope topped with the Assignment Completion Report (see pages 6, 7 & 8). Page 6 is for you to paste on top
of your envelope whilst pages 7 and 8 are for you to document your Test Plan, and write your comments (including any
special instructions to run your program) - to be inserted into the envelope.
In your .java program, you are to include a blocked comment at the top stating:
q q Your name, group, student ID.
q q Assumptions (if any) or any deviations from the specified requirements.
q q Any features that you would like to highlight.
6. 5. WALK-THROUGH OF PROGRAM
Monday 25th February at 9:30 a.m. SHARP
In the walk-through, you will be asked to give short, written answers to some questions about your program. These questions will assess
your basic understanding of the code that you are handing in. If you fail to display adequate understanding of your own program, you can
be down-graded by up to two letter grades from what you would have normally received. It is also possible that you will be called to
perform a demonstration cum explanation of your work if it is suspected that you have copied someone else�s work. Lesson: do your own
work and you will have no problem!
7. 6. GRADING CRITERIA FOR PROGRAMMING
Correct and robust implementation of basic features 55 %
Additional features 20 %
Programming style:� � Program design� � Appropriate use of arrays� � Appropriate use of variables, methods, and parameters� � Proper usage of control structures (e.g. if/else, loops) 15 %
Good programming practice:� � Meaningful variable names � � Proper indentations� � Useful and neat comments 5 %
Adequate (black-box) testing:� � Suitably-designed test plan 5 %
Total: 100 %
PROBLEM SOLVING & PROGRAMMING II
(Dip IT/MMC/EI, Year 1, Semester 2)
Assignment Completion Report (to be attached to cover of envelope)
Name: ___________________________________ Group: ________
ID: ___________________ Date & Time submitted: ____________
Requirements % Done (0-100) Remarks
BASIC FEATURES
� � Can choose category (and select appropriate additives)
� � Can choose drink (with error checking)
� � Can display amount payable
� � Can indicate availability of drink (with error checking)
� � Can accept payment for drink (with error checking)
� � Can dispense drink
� � Can update stock
ADDITIONAL FEATURES
� � Smart GUI
� � Multiple Orders
� � Sales Analysis (with password checking)
� � Stock Replenishment(with password checking)
� � Any other relevant features
Test Plan
Using black-box testing, record your test specification and the results according to the following format (the examples here are provided
for your reference only):
Test No. Purpose Test Shot/Data Expected Result Actual Result
E.g. 1a) Check whether beverage can be selected Click on �Chrysanthe-mum� button Checkbox for �Sugar� but not �Creamer� appear �Sugar� and checkboxes appeared
E.g. 1b) Check whether chrysanthemum with sugar can be ordered Select sugar and click on �Order� button Amount payable appears as �$1.10� (i.e., $1.00 + $0.10) Amount payable shown as $1.10
E.g. 1c) Check whether correct payment can be accepted Enter �1.00� in �Payment� textfield Error message �Insufficient payment - $0.10 short� appears Confirmation message �Drink being dispensed� appeared � ERROR!
E.g. 1d) Re-test 1c), after amending program As above As above Error message �Insufficient payment - $0.10 short� appeared
etc.
etc.
Remember to hand in this test plan together with the other deliverables in the envelope.
Have you�
1. 1. Checked to make sure program still works properly even with windows resized?
2. 2. Tested your program thoroughly, as if you're trying to break it?
Any comments about this assignment? Any special instructions to run your program? Write it here.public class testing1 {
String gg;
public void testing3() {
System.out.print(gg); }
// this is are constructor for the object and method we are going to make
next code
class testing {
public static void main(String[] args) {
testing1 tes = new testing1();
tes.gg = "hello there";
tes.testing3(); //here we have made a object and a method
hope this helps -
Help needed with this form in DW
Hi, i have created this form in dreamweaver but ive got this problem.
In the fields above the text field, the client needs to fill in some info such as name, email telephone number etc.
But the problem is when ill get the messages. Only the text from the large text field is there.
What did i do wrong??
http://www.hureninparamaribo.nl/contact.html
Thank you
Anybody??Thank you for your response. So what do i have to do to fix this?
Date: Sun, 20 Jan 2013 07:57:56 -0700
From: [email protected]
To: [email protected]
Subject: Help needed with this form in DW
Re: Help needed with this form in DW
created by Ken Binney in Dreamweaver General - View the full discussion
You have several duplicate "name" attributes in these rows which also appears in the first row
Telefoon:
Huurperiode:
Aantal personen:
Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5008247#5008247
Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5008247#5008247
To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5008247#5008247. In the Actions box on the right, click the Stop Email Notifications link.
Start a new discussion in Dreamweaver General by email or at Adobe Community
For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746. -
Help needed with this tutorial please
Hello in this InsertUpdateDelete tutorial at:
http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/index.jsp
or
http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/inserts_updates_deletes.html
and in this paragraph:
Changing the Column Components
and this statement
In the Visual Designer, select the top Drop Down List component in the Table.
"It's pretty confusing because there isn't a Drop Down List component in the Table as far as i can tell. There is a Drop Down List on the canvas up above this data table, but that has already been bound in a previous process, here is that previous proces:"
Configuring the Drop Down List
Select the Drop Down List in the Visual Designer and, in the Properties window, change its General > id property to personDD.
Right-click the personDD Drop Down List in the Visual Designer and choose Bind to Data from the pop-up menu. The Bind to Data dialog box appears.........
Can anyone tell me where i can get help with this tutorial or where i can download the finished program so i can sync up with what is actually being referenced in the questional statement that i mentioned above please?
Thanks very much!
BobKIn Step 5 of "Changing the Column Components" you change the Trip Type column to a drop-down list.
5. Select TRIP.TRIPTYPEID from the Selected list and make the following changes:
* Change the Header text field from TRIPTYPEID to Trip Type.
* Using the drop-down list, change the Component Type from Static Text to Drop Down List.
6. Click OK to enforce your changes and dismiss the window. If the table columns are too wide after performing the above steps, you can resize them by selecting the first component in each column and dragging its selection handles.
7. In the Visual Designer, select the top Drop Down List component in the Table. Right-click and choose Bind to Data from the pop-up menu. The Bind to Data dialog box opens. -
Help needed with this scenario
Hi,
This is a scenario to be implemented using workflows.
Can you tell me how to go about with this.
there is a form on the portal. User enters some details there. Then there is a submit button. when the user presses the submit button, a workflow is triggered on the R/3 side. A work item is sent to the manager which has a form ( the form's layout and data are the same as that of the portal screen ). Basically whatever the user enters in the portal screen is sent as a form to his manager, who can then approve it or reject it.
Can anyone tell me how this can be done.....the general steps...connectivity between portal and R/3 workflowHi Vijay,
If you are on R3 Enterprise or above, you can crate a BSP application to get user data and create an iview for this BSP Application. Within BSP application you can use "SWJ_WAPI_START_WORKFLOW" to trigger the workflow.
Cheers,
Sanjeev -
HELP Needed with this error: Exception in thread "main" java.lang.NoClass
Folks,
I am having a problem connecting to my MSDE SQL 2000 DB on a WindowsXP pro. environment. I am learning Java and writing a small test prgm to connect the the database. The code compiles ok, but when I try to execute it i keep getting this error:
"Exception in thread "main" java.lang.NoClassDefFoundError: Test1"
I am using the Microsoft jdbc driver and my CLASSPATH is setup correctly, I've also noticed that several people have complained about this error, but have not seen any solutions....can someone help ?
Here is the one of the test programs that I am using:
import java.sql.*;
* Microsoft SQL Server JDBC test program
public class Test1 {
public Test1() throws Exception {
// Get connection
DriverManager.registerDriver(new
com.microsoft.jdbc.sqlserver.SQLServerDriver());
Connection connection = DriverManager.getConnection(
"jdbc:microsoft:sqlserver://LAPTOP01:1433","sa","sqladmin");
if (connection != null) {
System.out.println();
System.out.println("Successfully connected");
System.out.println();
// Meta data
DatabaseMetaData meta = connection.getMetaData();
System.out.println("\nDriver Information");
System.out.println("Driver Name: "
+ meta.getDriverName());
System.out.println("Driver Version: "
+ meta.getDriverVersion());
System.out.println("\nDatabase Information ");
System.out.println("Database Name: "
+ meta.getDatabaseProductName());
System.out.println("Database Version: "+
meta.getDatabaseProductVersion());
} // Test
public static void main (String args[]) throws Exception {
Test1 test = new Test1();I want to say that there was nothing wrong
with my classpath config., I am still not sure why
that didn't work, there is what I did to resolved
this issue.You can say that all you like but if you are getting NoClassDefFound errors, that's because the class associated with the error is not in your classpath.
(For future reference: you will find it easier to solve problems if you assume that the problem is your fault, instead of trying to blame something else. It almost always is your fault -- at least that's been my experience.)
1. I had to set my DB connection protocol to TCP/IP
(this was not the default), this was done by running
the
file "svrnetcn.exe" and then in the SQL Server Network
Utility window, enable TCP/IP and set the port to
1433.Irrelevant to the classpath problem.
2. I then copied all three of the Microsoft JDBC
driver files to the ..\jre\lib\ext dir of my jdk
installed dir.The classpath always includes all jar files in this directory. That's why doing that fixed your problem. My bet is that you didn't have the jar file containing the driver in your classpath before, you just had the directory containing that jar file.
3. Updated my OS path to located these files
and....BINGO! (that simple)Unnecessary for solving classpath problems.
4. Took a crash course on JDBC & basic Java and now I
have created my database, all tables, scripts,
stored procedures and can read/write and do all kinds
of neat stuff.All's well that ends well. After a few months you'll wonder what all the fuss was about. -
Can anyone help me with this assignment
input needs to be grabbed from file
Brazil 1 France 2
France 1 Germany 2
Germany 0 Japan 3
Germany 2 Brazil 0
France 4 Japan 4
Then the corresponding summary written to standard output should be:
Team W D L F A P
Germany 2 0 1 4 4 6
Japan 1 1 0 7 4 4
France 1 1 1 7 7 4
Brazil 0 0 2 1 4 0
For each team, the output contains the number of games won (W), the number of games drawn (D), the number of games lost (L), the total number of goals scored (F, "goals for"), the total number of goals scored by the teams' opponents (A, "goals against"), and the total number of points (P). A team scores 3 points for a win, 1 point for a draw, and 0 points for a loss.
The assignment suggest the use of maps but i am not sure how i can use maps to help me as i am relitivley new to the collections heirahcy.
here is the code that i have so far assembled.
import java.io.*;
import java.util.*;
class Soccer
//declare varibles
StringTokenizer st; // StringTokenizer for separating values
BufferedReader in; // BufferedReader for reading standard input
BufferedReader infile; // reads data from input file
String input; // holds input data temporarily
int count; // String input to hold line details
Map teams = new HashMap(); //creates a new hash map for holding data
public static final Integer ONE = new Integer(1); //for distinct wrods count
String[] temp;
public static void main (String [] args)
Soccer app = new Soccer();
app.input(args);
}//end main
public void input(String [] args)
try{
//standard output to screen
in = new BufferedReader(new InputStreamReader(System.in));
//input from filend class
infile = new BufferedReader(new FileReader(args[0]));
input = infile.readLine();
st = new StringTokenizer(input);
count = st.countTokens();
temp = new String[count];
for(int i = 0; i < count; i++)
temp[i] = st.nextToken();
}//end for
//start if map code
Map map = new HashMap(); // Maps words to no. of occs.
for (int i = 0; i < count; i++) {
// Get number of occurrences of next word
Integer value = (Integer) map.get(temp);
// Increment number of occurrences of word
if (value == null) {
map.put(temp[i], ONE);
} else {
int val = value.intValue();
map.put(temp[i], new Integer(val+1));
}//end for
// Print values of map, one per line
Iterator it = map.keySet().iterator();
while (it.hasNext() ) {
Object key = it.next();
System.out.println(key + " = " + map.get(key));
} catch (IOException e){
System.out.println("ERROR: " + e.getMessage());
//call the print method
print();
}//end input
public void print()
System.out.println("Team W D L A P ");
}//end print
}//end classPass the filename in as an argument.
import java.io.*;
import java.util.*;
public class Ivg1
static class Team
String name;
int played;
int won;
int lost;
int fore;
int against;
public int getDrawn() { return played-won-lost; }
public int getPoints() { return (won*3)+getDrawn(); }
public String toString() {
return name +"\t" +won +" " +getDrawn() +" " +lost +" " +fore +
" " +against +" " +getPoints();
public static void main(String[] argv)
throws Exception
BufferedReader reader= new BufferedReader(new FileReader(argv[0]));
Hashtable teams= new Hashtable();
for (String line= null; (line= reader.readLine()) != null;) {
StringTokenizer st= new StringTokenizer(line);
String homeTeam= st.nextToken();
int homeScore= Integer.parseInt(st.nextToken());
String awayTeam= st.nextToken();
int awayScore= Integer.parseInt(st.nextToken());
Team team1= (Team) teams.get(homeTeam);
Team team2= (Team) teams.get(awayTeam);
if (team1 == null) {
team1= new Team();
team1.name= homeTeam;
teams.put(team1.name, team1);
if (team2 == null) {
team2= new Team();
team2.name= awayTeam;
teams.put(team2.name, team2);
if (homeScore > awayScore) {
team1.won++;
team2.lost++;
if (homeScore < awayScore) {
team1.lost++;
team2.won++;
team1.played++;
team1.fore += homeScore;
team1.against += awayScore;
team2.played++;
team2.fore += awayScore;
team2.against += homeScore;
System.err.println("Team\tW D L F A P");
TreeSet set= new TreeSet(new Comparator() {
public int compare(Object o1, Object o2) {
return ((Team) o1).getPoints() < ((Team) o2).getPoints() ? 1 : -1;
Iterator iterator= teams.values().iterator();
while (iterator.hasNext())
set.add(iterator.next());
iterator= set.iterator();
while (iterator.hasNext())
System.err.println(iterator.next().toString());
} -
Hello,
I would like to enquire on whether this VI has any error. I need to configure the digital input as a positive limit switch which is a sensor which when blocked, will produce a change in the voltage pulse.
Attachments:
sensor.vi 34 KBHello,
I could not open. Can you save it for LabView 8.2 or 8.5?
Andy
Best Regards,
Andy
PCI-7356@UMI7764; PCIe-6320@SCB-68; LV2011; Motion Assistant 2.7; NI Motion 8.3; DAQmx 9.4; Win7 -
Help need with this expression
I am trying to calculate the ratio... so basically doing the adding two textboxes different textboxes and then diving them with the the sum of two different textboxes... but i am getting an #error..
=(iif(reportItems!Textbox76.Value = nothing,"0.00",reportItems!Textbox76.Value) + iif(reportitems!Textbox94.Value = nothing,"0.00",reportitems!Textbox94.Value)) / iif(((IIF(reportitems!Textbox69.Value = nothing,"0.00",reportitems!Textbox69.Value) + iif(reportitems!Textbox85.Value = nothing,"0.00",reportitems!Textbox85.Value))) = "0.00",1,((IIF(reportitems!Textbox69.Value = nothing,"0.00",reportitems!Textbox69.Value) + iif(reportitems!Textbox85.Value = nothing,"0.00",reportitems!Textbox85.Value))))
Thanks
KarenHi Karen,
I have tested the expression below, it turn out that if one of textboxes's value contain the character except number, then the result of this expression is #Error.
In your scenario, please ensure that there is no any #Error for the below expression:
=Cint(ReportItems!TextBox76.Value)
=Cint(ReportItems!TextBox94.Value)
=Cint(ReportItems!TextBox69.Value)
=Cint(ReportItems!TextBox85.Value)
If you have any questions, please feel free to ask.
Regards,
Charlie Liao
TechNet Community Support -
Help Needed with this stupid Nano
I have got a Nice shiny green 16Gb 4th Gen Ipod Nano and I have got all 130+ albums with covers on etc but i cant get my videos to come on via itunes.
I have even downloaded the sample video from apple which is .mov and clicked add to library and it show under movies but when i goto connect the cable it says its syncing and then ejects but no videos on there.
Please helpIn Step 5 of "Changing the Column Components" you change the Trip Type column to a drop-down list.
5. Select TRIP.TRIPTYPEID from the Selected list and make the following changes:
* Change the Header text field from TRIPTYPEID to Trip Type.
* Using the drop-down list, change the Component Type from Static Text to Drop Down List.
6. Click OK to enforce your changes and dismiss the window. If the table columns are too wide after performing the above steps, you can resize them by selecting the first component in each column and dragging its selection handles.
7. In the Visual Designer, select the top Drop Down List component in the Table. Right-click and choose Bind to Data from the pop-up menu. The Bind to Data dialog box opens. -
hi,
I'm using this IS Oil BAPI RFC_SDCONOIL_CREATEFROMDATA for uploading sales contracts. When we create a contract this BAPI is popping up a dialog asking for some input values. There is no way that these input values can be supplied through the BAPI itself. Is there any way to supress such pop up dialogs after the execution of BAPIs.
VijayI don't have experience in IS-OIL, but what are the values that you are asked to enter? Did you check if you can set some SPA/GPA parameters to care of them? Look at the code where this pop-up comes and see if it is executed conditionally. If it is, then check what you are not satisfying in that condition.
Srinivas -
why can't I read any Hallmark cards? and I do have adobe flash down loaded 11.7 on my pc ?
What exactly means "can't"? What is your full Flash Player version?
-
Need help with this assignment!!!!
Please help me with this. I am having some troubles. below is the specification of this assignment:
In geometry the ratio of the circumference of a circle to its diameter is known as �. The value of � can be estimated from an infinite series of the form:
� / 4 = 1 - (1/3) + (1/5) - (1/7) + (1/9) - (1/11) + ...
There is another novel approach to calculate �. Imagine that you have a dart board that is 2 units square. It inscribes a circle of unit radius. The center of the circle coincides with the center of the square. Now imagine that you throw darts at that dart board randomly. Then the ratio of the number of darts that fall within the circle to the total number of darts thrown is the same as the ratio of the area of the circle to the area of the square dart board. The area of a circle with unit radius is just � square unit. The area of the dart board is 4 square units. The ratio of the area of the circle to the area of the square is � / 4.
To simuluate the throwing of darts we will use a random number generator. The Math class has a random() method that can be used. This method returns random numbers between 0.0 (inclusive) to 1.0 (exclusive). There is an even better random number generator that is provided the Random class. We will first create a Random object called randomGen. This random number generator needs a seed to get started. We will read the time from the System clock and use that as our seed.
Random randomGen = new Random ( System.currentTimeMillis() );
Imagine that the square dart board has a coordinate system attached to it. The upper right corner has coordinates ( 1.0, 1.0) and the lower left corner has coordinates ( -1.0, -1.0 ). It has sides that are 2 units long and its center (as well as the center of the inscribed circle) is at the origin.
A random point inside the dart board can be specified by its x and y coordinates. These values are generated using the random number generator. There is a method nextDouble() that will return a double between 0.0 (inclusive) and 1.0 (exclusive). But we need random numbers between -1.0 and +1.0. The way we achieve that is:
double xPos = (randomGen.nextDouble()) * 2 - 1.0;
double yPos = (randomGen.nextDouble()) * 2 - 1.0;
To determine if a point is inside the circle its distance from the center of the circle must be less than the radius of the circle. The distance of a point with coordinates ( xPos, yPos ) from the center is Math.sqrt ( xPos * xPos + yPos * yPos ). The radius of the circle is 1 unit.
The class that you will be writing will be called CalculatePI. It will have the following structure:
import java.util.*;
public class CalculatePI
public static boolean isInside ( double xPos, double yPos )
public static double computePI ( int numThrows )
public static void main ( String[] args )
In your method main() you want to experiment and see if the accuracy of PI increases with the number of throws on the dartboard. You will compare your result with the value given by Math.PI. The quantity Difference in the output is your calculated value of PI minus Math.PI. Use the following number of throws to run your experiment - 100, 1000, 10,000, and 100,000. You will call the method computePI() with these numbers as input parameters. Your output will be of the following form:
Computation of PI using Random Numbers
Number of throws = 100, Computed PI = ..., Difference = ...
Number of throws = 1000, Computed PI = ..., Difference = ...
Number of throws = 10000, Computed PI = ..., Difference = ...
Number of throws = 100000, Computed PI = ..., Difference = ...
* Difference = Computed PI - Math.PI
In the method computePI() you will simulate the throw of a dart by generating random numbers for the x and y coordinates. You will call the method isInside() to determine if the point is inside the circle or not. This you will do as many times as specified by the number of throws. You will keep a count of the number of times a dart landed inside the circle. That figure divided by the total number of throws is the ratio � / 4. The method computePI() will return the computed value of PI.
and below is what i have so far:
import java.util.*;
public class CalculatePI
public static boolean isInside ( double xPos, double yPos )
boolean result;
double distance = Math.sqrt( xPos * xPos + yPos * yPos );
if (distance < 1)
result = true;
return result;
public static double computePI ( int numThrows )
Random randomGen = new Random ( System.currentTimeMillis() );
double xPos = (randomGen.nextDouble()) * 2 - 1.0;
double yPos = (randomGen.nextDouble()) * 2 - 1.0;
boolean isInside = isInside (xPos, yPos);
int hits = 0;
double PI = 0;
for ( int i = 0; i <= numThrows; i ++ )
if (isInside)
hits = hits + 1;
PI = 4 * ( hits / numThrows );
return PI;
public static void main ( String[] args )
Scanner sc = new Scanner (System.in);
System.out.print ("Enter number of throws:");
int numThrows = sc.nextInt();
double Difference = computePI(numThrows) - Math.PI;
System.out.println ("Number of throws = " + numThrows + ", Computed PI = " + computePI(numThrows) + ", Difference = " + Difference );
}when i tried to compile it says "variable result might not have been initialized" Why is this? and please check this program for me too see if theres any syntax or logic errors. Thanks.when i tried to compile it says "variable result might not have been
initialized" Why is this?Because you only assigned it if distance < 1. What is it assigned to if distance >= 1? It isn't.
Simple fix:
boolean result = (distance < 1);
return result;
or more simply:
return (distance < 1);
and please check this program for me too see if theres any syntax or
logic errors. Thanks.No, not going to do that. That's much more your job, and to ask specific questions about if needed. -
I need to reinstall my operating system for 10.5 after seeing a file folder and question mark flashing on my start up screen. Can anyone help me with this?
Hello,
That means it can find the Hard Drive, or can't find the things needed for booting.
See if DU even sees it.
"Try Disk Utility
1. Insert the Mac OS X Install disc, then restart the computer while holding the C key.
2. When your computer finishes starting up from the disc, choose Disk Utility from the Installer menu at top of the screen. (In Mac OS X 10.4 or later, you must select your language first.)
*Important: Do not click Continue in the first screen of the Installer. If you do, you must restart from the disc again to access Disk Utility.*
3. Click the First Aid tab.
4. Select your Mac OS X volume.
5. Click Repair Disk, (not Repair Permissions). Disk Utility checks and repairs the disk."
http://docs.info.apple.com/article.html?artnum=106214
Then try a Safe Boot, (holding Shift key down at bootup), run Disk Utility in Applications>Utilities, then highlight your drive, click on Repair Permissions, reboot when it completes.
(Safe boot may stay on the gray radian for a long time, let it go, it's trying to repair the Hard Drive.) -
Mail on my Mac computer does not update when I update my mail on my iPhone and iPad. Can anyone help me with this? Is there a setting that I need to check?
All that you had to do was to sign into the old account in order to update those apps. What I mean is that you just needed to sign into that account in the store settings like I described and that should have worked. You didnt need to enter the credit card information again - you justed needed to use the old ID and password.
Anyway, I think the good news is that if everything else is OK with the new account, just download iBooks with the new ID - it's a free app so its not like you have to pay for it again. I'm not sure what the other App is that you are talking about - but if it is the Apple Store App - that is free as well.
Try this anyway, when you try to update iBooks, just use the old password if the old ID still pops up.
Did you try signing into the store settings with your new ID and see what happens with the updates then?
Maybe you are looking for
-
Weird Problem With Dates in Finder and Mail
I have a MBPr running 10.8.2 which is exhibiting a very strange behaviour related to dates. Initially, the problem manifested in Mail where the date shown in the message list for each message was exactly the same, regardless of the date sent/received
-
Can anyone tell why my Itunes will only play 5 or 6 songs on shuffle then stop even in the middle of a song, and the only way to fix it is to exit Itunes completley and reopen it?????
-
Problem in SXI_CACHE ReturnCode 99
Hi Everyone, We're encountering a problem in our Test box. The return code for one of our integration processes is still 99 even after activating it in SXI_CACHE. In our acceptance box and Dev box, the return code is 0. Everything is working fine for
-
Camera Issue without flash on.
Ok, I have let's say some teething problems with my iphone 4s. I have the battery issue where sometimes it doesnt charge to 100% (although my battery life is good), I also have the annoying background interference when i make a call and 3g is turned
-
How to use Field-symbol with dynamic select query
Can anybody tell me, how to use field-symbols in the dynamic select query.