Help pls..urgent
// why the marks will not add when answer is true ?
import java.io.*;
import java.util.*;
class quizLer{
public static void main(String[] args) throws IOException{
BufferedReader in = new BufferedReader (new InputStreamReader(System.in));
int marks = 0;
String ans = "";
String[] questionAns = new String[5];
questionAns[0] = "2";
questionAns[1] = "4";
questionAns[2] = "0";
questionAns[3] = "4";
questionAns[4] = "0";
boolean correctAns = false;
ArrayList arr = new ArrayList();
arr.add(0, "1 + 1 =");
arr.add(1, "2 + 2 = ");
arr.add(2, "2 - 2 =");
arr.add(3, "2 * 2 =");
arr.add(4, "1 - 1 =");
java.util.Collections.shuffle(arr);
for(int i=1; i<=4; i++){
System.out.print(i +". " +arr.get(i));
ans = in.readLine();
if(ans.equals(correctAns)){
marks += 25;
if(ans.equals(correctAns)){
marks += 25;
if(ans.equals(correctAns)){
marks += 25;
if(ans.equals(correctAns)){
marks += 25;
if(ans.equals(correctAns)){
marks += 25;
if(arr.get(0).equals(questionAns[0])){
correctAns = true;
if(arr.get(1).equals(questionAns[1])){
correctAns = true;
if(arr.get(2).equals(questionAns[2])){
correctAns = true;
if(arr.get(3).equals(questionAns[3])){
correctAns = true;
if(arr.get(4).equals(questionAns[4])){
correctAns = true;
System.out.println("Total marks is: " +marks);
}
There is a mistake with this:if(ans.equals(correctAns)) {
marks += 25;
}correctAns is the boolean value "false" so comparing it with the String ans will always
yield false. You only set correctAns to something later on.
Perhaps you should say: for(int i=1; i <= 4; i++) {
System.out.print(i +". " +arr.get(i));
ans = in.readLine();
// first figure out if they got the answer right
correctAns = ans.equals(questionAns);
// then update marks accordingly
if(correctAns) {
marks += 25;
// now print total marksHow many questions does your program ask? Do you really mean this?
There seems to be a big problem with your use of the shuffle() method - it shuffles the
questions, but not the answers. If I were you I would remove that line until everything
else (the number of questions displayed and the accumulation of the marks) was
correct.
Similar Messages
-
HELP PLS URGENT IIS VISTA USERS
Thanks, Sorry bit out of topic but this is a trusty forum.
I got a virus, my comp can't boot into safe mode and the
crappy repair function on XP freezes, so my next option is to
reformat, plus I was just about to backup my files but luckilly
it's on a different partition.
I installed vista previously and was having such a drama with
the new version of IIS, that basically nothing would work. It
frustrated me that much that I went back to XP and the old version
of IIS
Should I now go back to Vista and the new version of IIS?
Has anyone had any problems with Vista and the new IIS?
Any guidence on this please?
ps: I know I should be Apache and unixWell unfortunately, IIS 7, which ships on Vista, is
technically not an official release until the release of Windows
Server 2008. If IIS is imperative to your solution right now I
would stick with XP & IIS 6 since that is what Windows Server
2003 supports. However, I would recommend going out and purchasing
some A/V software and Firewall software for your PC just to ensure
this problem does not happen again.
I believe that Vista SP 1 will closely correlate to the
release of Windows Server 2008 which would probably be a better
time to take another look at Vista and IIS 7. -
My BB9810 refuse to load OS7.1 software on my phone after the download has completed. My phone has freezed/stucked since morning. Pls urgent help/assistant needed as I can not access/use my phone for over 24hrs now.
Hi there,
Use the method described in the link below to get back up and running:
http://supportforums.blackberry.com/t5/Device-software-for-BlackBerry/How-To-Reload-Your-Operating-S...
I hope this info helps!
If you want to thank someone for their comment, do so by clicking the Thumbs Up icon.
If your issue is resolved, don't forget to click the Solution button on the resolution! -
Help me doing bapi related to catsdb only pls urgent step by step
Help me doing bapi related to catsdb only pls urgent step by step
thank you,
points will be rewarded,
Regards,
Jagrut BharatKumar ShuklaHelp me doing bapi related to catsdb only pls urgent step by step
thank you,
points will be rewarded,
Regards,
Jagrut BharatKumar Shukla -
How to create matrix template help pls
hi frs,
i have generated xml file after creating matrix report in report builder.
i want to know how to create matrix template(rtf) in word document.
if i use wizard or insert> all fields i am not getting rtf like matrix.
help pls
Thanks
RajeshThis issue is really becoming a problem for us. Does anyone have any examples of label templates. The label when generated automatically converts from pontrait to landscape. If you increase the size of the template then word complains about the page and margin size before printing.
Anyone have any ideas?
Thanks -
my ipod touch screen is totally unresponsive and i have been using it under normal conditions. ihave tried the reset and restore but to no avail.everything works as it would normally do on the screen.help pls????
Might want to post your question in the correct forum. This is the iPHONE forum.
-
I have a MacBook Pro 15" laptop with Retina running OSX 10.8.5. It will not recognize that my android device (Samsung Galaxy Note3). I am using the standard USB that came out of the box to connect my device to my MAC. Deleted Kies 4 MAC. Help Pls!
Dee002 wrote:
MacBook's only have 2.0 USB ports.
Wrong.
If you're not going to provide correct advice then don't repsond at all.
http://www.apple.com/macbook-pro/specs-retina/ -
i made a mistake. i installed windows using boot camp without os x lion dvd. what should i do? help pls
Re: can i install windows for pc on my mac or do i need the windows for mac?There is no Lion DVD. Start Boot Camp Assistant and select the menu item to download the Windows Support Software.
Read and follow the Boot Camp Installation Guide. http://manuals.info.apple.com/en_US/boot_camp_install-setup_10.7.pdf -
Dear Ones,
I have Firefox 10.0.2. and OSX 10.6.8. and the latest PDF adobe reader, and still can not open with the browser PDF files.Can someone help,pls?Thanxsee if this is helpful : [http://support.mozilla.org/en-US/kb/Opening%20PDF%20files%20within%20Firefox Opening PDF files within Firefox]
thank you
Please mark "Solved" the answer that really solve the problem, to help others with a similar problem. -
"Adobe Illustrator cs5 quit unexpectedly" error message.
After I upgrated my imac from Snow Leopard to Mavericks I can't open Illustrator CS5. (No problem with PS)
Every opening attemp crashes. May this be possible because of third party plug-ins. (eg. Esko Artwork)
Help pls.
Thank you.Launch the Console application in any of the following ways:
☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
Step 1
For this step, the title of the Console window should be All Messages. If it isn't, select
SYSTEM LOG QUERIES ▹ All Messages
from the log list on the left. If you don't see that list, select
View ▹ Show Log List
from the menu bar at the top of the screen.
In the top right corner of the Console window, there's a search box labeled Filter. Initially the words "String Matching" are shown in that box. Enter the name of the crashed application or process. For example, if iTunes crashed, you would enter "iTunes" (without the quotes.)
Each message in the log begins with the date and time when it was entered. Select the messages from the time of the last crash, if any. Copy them to the Clipboard by pressing the key combination command-C. Paste into a reply to this message by pressing command-V.
☞ The log contains a vast amount of information, almost all of which is irrelevant to solving any particular problem. When posting a log extract, be selective. A few dozen lines are almost always more than enough.
Please don't indiscriminately dump thousands of lines from the log into this discussion.
Please don't post screenshots of log messages—post the text.
☞ Some private information, such as your name, may appear in the log. Anonymize before posting.
Step 2
In the Console window, select
DIAGNOSTIC AND USAGE INFORMATION ▹ User Diagnostic Reports
(not Diagnostic and Usage Messages) from the log list on the left. There is a disclosure triangle to the left of the list item. If the triangle is pointing to the right, click it so that it points down. You'll see a list of crash reports. The name of each report starts with the name of the process, and ends with ".crash". Select the most recent report related to the process in question. The contents of the report will appear on the right. Use copy and paste to post the entire contents—the text, not a screenshot.
I know the report is long, maybe several hundred lines. Please post all of it anyway.
☞ If you don't see any reports listed, but you know there was a crash, you may have chosen Diagnostic and Usage Messages from the log list. Choose DIAGNOSTIC AND USAGE INFORMATION instead.
In the interest of privacy, I suggest that, before posting, you edit out the “Anonymous UUID,” a long string of letters, numbers, and dashes in the header of the report, if it’s present (it may not be.)
☞ Please don’t post other kinds of diagnostic report—they're very long and rarely helpful. -
Need some quick help - fairly urgent!
I've just taken over a new job and have been the task of finishing the new brochure for Christmas, there's not a lot to do but a lot of the measurements need changing
This is the layout I'm dealing with..
All the boxes have been made in Illustrator
The text has been done in In'Design and it seems every piece of text is it's own box if that makes sense
My question is, if I select the whole specification box - copy, paste it into Adobe Illustrator and change the text there, then paste the edited box back into In-Design, will I lose quality when it gets printed?
I'm worried if I do it this way it may come out blurred? Or am I just worrying about nothing?I couldn't find an Illy file in the end and have ended up creating tables in ID to replicate what was already there!
Didn't take very long and I guess if I didn't do it now, I'd come across the same situation next time!
Date: Wed, 30 Nov 2011 08:48:07 -0700
From: [email protected]
To: [email protected]
Subject: Need some quick help - fairly urgent!
Re: Need some quick help - fairly urgent!
created by Peter Spier in InDesign - View the full discussion
There certainly are viable "quick fix" solutions proposed here, and if the dealine is looming and this file never needs to be touched again I might be tempted, but they are only postponing the pain for a file that needs periodic updates, and I wouldn't waste effort on them, myself, when that time can be put toward a proper rebuild now if that's the ultimate goal.
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/4054725#4054725
To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4054725#4054725. In the Actions box on the right, click the Stop Email Notifications link.
Start a new discussion in InDesign by email or at Adobe Forums
For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746. -
Unable to get Rmi program working. Help plz - urgent.
Any help to get this problem resolved would be of help.
I get the error as below:
D:\test\nt>java Client
Server
Client exception: Error marshaling transport header; nested exception is:
javax.net.ssl.SSLException: untrusted server cert chain
java.rmi.MarshalException: Error marshaling transport header; nested exception is:
javax.net.ssl.SSLException: untrusted server cert chain
javax.net.ssl.SSLException: untrusted server cert chain
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.ssl.ClientHandshaker.a([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.ssl.Handshaker.process_record([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.ssl.AppOutputStream.write([DashoPro-V1.2-120198])
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:76)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:134)
at java.io.DataOutputStream.flush(DataOutputStream.java:108)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:207)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:178)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:87)
at Server_Stub.passArgs(Unknown Source)
at Client.main(Client.java, Compiled Code)
the server was invokde as:
D:\test\nt>java -Djava.rmi.server.codebase="file:/d:/test" -Djava.policy=d:/test/policy Server a b c
Server bound in registry
where policy had allpermission
The server program is given as below:
import java.net.InetAddress;
import java.rmi.Naming;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.RemoteException;
import java.rmi.RMISecurityManager;
import java.rmi.server.UnicastRemoteObject;
public class Server extends UnicastRemoteObject implements Message
private static String[] args;
public Server() throws RemoteException
// super();
super(0, new RMISSLClientSocketFactory(),
new RMISSLServerSocketFactory());
public String[] passArgs() {
System.out.println(args[0]);
System.out.println(args[1]);
System.out.println(args[2]);
System.out.println(args.length);
System.out.println();
return args;
public static void main(String a[])
// Create and install a security manager
if (System.getSecurityManager() == null)
System.setSecurityManager(new RMISecurityManager());
args=a;
try
Server obj = new Server();
// Bind this object instance to the name "Server"
Registry r = LocateRegistry.createRegistry(4646);
r.rebind("Server", obj);
System.out.println("Server bound in registry");
} catch (Exception e) {
System.out.println("Server err: " + e.getMessage());
e.printStackTrace();
The RMISSLServerSocketFactory class is as below:
import java.io.*;
import java.net.*;
import java.rmi.server.*;
import javax.net.ssl.*;
import java.security.KeyStore;
import javax.net.*;
import javax.net.ssl.*;
import javax.security.cert.X509Certificate;
import com.sun.net.ssl.*;
public class RMISSLServerSocketFactory implements RMIServerSocketFactory, Serializable
public ServerSocket createServerSocket(int port)
throws IOException
SSLServerSocketFactory ssf = null;
try {
// set up key manager to do server authentication
SSLContext ctx;
KeyManagerFactory kmf;
KeyStore ks;
char[] passphrase = "passphrase".toCharArray();
ctx = SSLContext.getInstance("TLS");
kmf = KeyManagerFactory.getInstance("SunX509");
ks = KeyStore.getInstance("JKS");
ks.load(new FileInputStream("testkeys"), passphrase);
kmf.init(ks, passphrase);
ctx.init(kmf.getKeyManagers(), null, null);
ssf = ctx.getServerSocketFactory();
} catch (Exception e)
e.printStackTrace();
return ssf.createServerSocket(port);
The RMIClientSocketFactory is as below:
import java.io.*;
import java.net.*;
import java.rmi.server.*;
import javax.net.ssl.*;
public class RMISSLClientSocketFactory implements RMIClientSocketFactory, Serializable
public Socket createSocket(String host, int port)
throws IOException
SSLSocketFactory factory =(SSLSocketFactory)SSLSocketFactory.getDefault();
SSLSocket socket = (SSLSocket)factory.createSocket(host, port);
return socket;
And finally the client program is :
import java.net.InetAddress;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.RemoteException;
public class Client
public static void main(String args[])
try
// "obj" is the identifier that we'll use to refer
// to the remote object that implements the "Hello"
// interface
Message obj = null;
Registry r = LocateRegistry.getRegistry(InetAddress.getLocalHost().getHostName(),4646);
obj = (Message)r.lookup("Server");
String[] s = r.list();
for(int i = 0; i < s.length; i++)
System.out.println(s);
String[] arg = null;
System.out.println(obj.passArgs());
arg = obj.passArgs();
System.out.println(arg[0]+"\n"+arg[1]+"\n"+arg[2]+"\n");
} catch (Exception e) {
System.out.println("Client exception: " + e.getMessage());
e.printStackTrace();
The Message interface has the code:
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface Message extends Remote
String[] passArgs() throws RemoteException;
Plz. help. Urgent.
Regards,
LioneLhi Lionel,
have u got the problem solved ?
actually i need ur help regarding RMI - SSL
do u have RMI - SSL prototype or sample codings,
i want to know how to implement SSL in RMI
looking for ur reply
-shafeeq -
all of sudden, I can't launch iTunes as I get a popup saying "iTunes requires Quicktime 7.5.5 or later". I only have 7.4 currently and the apple site doesn't show anywhere to download Quicktime upgrade. Software Update detects no reqd updates. Help pls??
Here's a link to the QuickTime for Leopard 7.7 installer:
http://support.apple.com/kb/DL761 -
Pls urgent reply will be appreciated
A form i enclosed in a jscrollpane doesnt print the full form.
It only prints the part visible on the screen.
I,ve done all the 2d tricks like clipping, setting my imageable area all as i can...
pls urgent reply to this will be appreciated;
i attach my effort below..
public int print(Graphics g, PageFormat pf, int pageIndex) {
Graphics2D g2 = (Graphics2D) g;
Dimension d = getSize(); //get size of document
double panelWidth = d.width; //width in pixels
double panelHeight = d.height; //height in pixels
double pageHeight = pf.getImageableHeight(); //height of printer page
double pageWidth = pf.getImageableWidth(); //width of printer page
double scale = pageWidth / panelWidth;
//double scale2 = pageHeight / panelHeight;
int totalNumPages = (int) Math.ceil(scale * panelHeight / pageHeight);
if ( pageIndex >= totalNumPages ) {
return NO_SUCH_PAGE;
} else {
g2.translate(pf.getImageableX(), pf.getImageableY());
// shift Graphic to line up with beginning of next page to print
g2.translate(0f, -pageIndex * pageHeight);
// scale the page so the width fits...
g2.scale(scale, scale);
/*Rectangle rect = new Rectangle();
rect.x = getX();
rect.y = getY();
rect.width = getWidth();
rect.height = getHeight();
g2.setClip(rect);*/
paint(g2); //repaint the page for printing
//this.paintComponents(g2);
return PAGE_EXISTS;
}Oh, my, it was so urgent that you didn't have time to go through the tips on [_Getting started with Sun Forums _|http://wikis.sun.com/display/SunForums/Tips], which would have shown you how to use the forum's code tags.
db -
Please i need help very urgent !!! after deleting my exchange account because the company changed the password , I lost 150 200 contacts and i need to get them back very soon ! i never backed up on itunes ..please help
No. The contacts are "owned" by the Exchange server.
The Exchange server is owned by the company.
Everything on the Exchange server is owned by the company.
If you quit or were terminated, and your access to the system has been revoked, then there is nothing you and do at this point. Once you deleted the account from your phone, all of the associated data was deleted.
NEVER store personal information on company systems. -
Lsmw issue plz help its urgent
Hi Experts ,
i need to create a LSMW using batch input .
but the requirement is on the basis of conditions my recording need to be changed .
dat means
3127POL09 3127POL09-1 CTR 3127-1003E 100 FUL
3127POL09 3127POL09-2 WBS 3127POL01 60 FUL
for ctr i ill have to post data in screen number 200
and for wbs i ill have to post data in screen number 400 .
can we put some conditions in recording in lsmw ?
i no we can create multiple recording but how can we use them to fullfill my requirement .
plz help its urgent
thanx in advanceHi,
Within LSMW, there is an option to write our own code wherein this code can be incorporated.
This is in the Field Mapping Option...
Just go to the Menu Extras->Layout
and click on the check box Form Routines
Global Data.
Here you can define Global Variables and also perform your ABAP Coding.
Regards,
Balaji.
Maybe you are looking for
-
Lost recovery key and no acces to trusted devices
i lost my recovery key and I can't get acces to my trusted devices, there's much money on the account but some else is using the account wich I don't know, an I want to change the pw but I cant
-
Problems with BC Dataflow for PO History &Confirmations
Hello everyone, I´m fighting to combine Purhase Order History from SRM (DataSource 0SRM_TD_PO) with Confirmations (Goods receipts) and Invoices from ECC in BI in the DSO 0SRPO_D1. I will load the PO´s from SRMi do not get the Confirmations from ECC (
-
Is SAP workflow related with SAP XI? how?
Hi all, I'm new to ccBPM.. and am pretty much familiar with XI 3.0.... and functionality of the XI 3.0 versions..I am looking for some guide... espeically on the USAGE OF SAP BUSINESS WOFKFLOW.....pls cud u post the details on the forum. I am not sur
-
Creating Informix 2000 Data Server
Trying to create a Data Server for Informix, and when testing the connection, receive the following error: oracle.odi.core.exception.OdiRuntimeException: java.lang.IllegalArgumentException: Could not load JDBC driver class [com.informix.jdbc.IfxDrive
-
Hi I have a rek. In our Pl Books, say i have 5 KFs. A macro copies the data from customer forecast KF to Final Forecast KF. Now the requirement is that i need to stop the users from editing any value in the previous months for all 5 KFs. Means system