I want to create a method that is meant to protect against entering a wrong value for gender. The method **fineGender** below, will return true if the correct gender is entered and false otherwise. // postcondition: fineGender returns true if argument g equals M, m, F or f // and returns false otherwise. public static boolean fineGender(char g)

Member Avatar
Member Avatar
+0 forum 6

Hi guys, A quick problem that I'm facing with a return method. I've created a page for a friend with a questionnaire and i am validating all the radio buttons, this works nicely. When i want to verify the input fields of text type, it alerts me but the return false; it's not kicking in.... don't know why. <script type='text/javascript'> window.onload = function() { document.getElementById("trimite").onclick = function(e) { var checked = $("#container :radio:checked"); var groups = []; $("#container :radio").each(function() { if (groups.indexOf(this.name) < 0) { groups.push(this.name); } }); if (groups.length == checked.length) { alert('Multumim ca ati raspuns la acest chestionar!'); …

Member Avatar
Member Avatar
+0 forum 2

Im stuck with the following: Define a function isPrime(number) that takes in a number as argument and return True if the number is a prime number. Hint: A number, x is a prime number if it is only divisible by 1 and x itself. By definition, 1 is not a prime number. [CODE] Examples >>> isPrime(97) True >>> isPrime(1) False >>> isPrime(-2) False [/CODE] [CODE] # Hint: Step through the range between (2, number-1), # and determine if the number is divisible using the modulus operator. def isPrime(x): [/CODE] how should i go about this? i dont understand it. Any …

Member Avatar
Member Avatar
+0 forum 5

okay, so i was doing an exercise for this beginning python course i got my hands on, and i just completed the exercise (took longer than it should have though) and for some reason, when i run it, it returns data i didn't expect, and when i run it again it return correctly. i just dont understand?! here is the exercise information; exercise 7.3 Improve the program you wrote for exercise 7.2: > Make it loop until exit is requested by the user hitting <return> only. > Allow the stop and increment parameters to be optional; supply defaults for when …

Member Avatar
Member Avatar
+0 forum 3

so i'm created a program that display the name and grade of students from a file, and also a boolean that checks to see if the names are in alphabetical order. The problem is that i've created a files that has a name in alphabetical order but it still returns false [CODE]class Assignment { //------------------------------------------------------------------------------ public static void main (String [] args) throws Exception { Scanner kb = new Scanner(System.in); System.out.print("\nEnter name of a file of Students: "); String filename = kb.nextLine(); Section sec = new Section(filename); System.out.println("\nIn forward order:"); sec.print(System.out); System.out.println("\nhasNamesAscending() --> " + sec.hasNamesAscending()); } //------------------------------------------------------------------------------ } // …

Member Avatar
Member Avatar
+0 forum 2

The last time I was making a program, I wanted to input from user a boolean answer (to save space ;)) An input of 0/1 works good (0-false) and (1-true), but if the user inputs the boolean values as "true" and "false", it comes out to be an error. So, are there any ways of doing so.? I believe, that the strings "true" and "false" are defines using #define in the header files because of which the input is creating an error. Am i correct.?

Member Avatar
Member Avatar
+0 forum 5

Hi all, and thanks in advance for any replies :) So I have a 300GB hard disk with Windows 7 on it, I also have a NAS drive for storing my music etc, so my C:\ drive only has to have the OS, my apps and games. Now a couple of weeks ago I got a prompt from Windows informing me I only have a couple of MB left on C:\, so, I ran disk cleanup and CCleaner to completely remove any browser junk and emptied my recycle bin. This saved me about 1GB. I know I haven't used anywhre …

Member Avatar
Member Avatar
+0 forum 2

The End.