CSE 14 Chapter 0: Mini Lecture - PA5 Stuff

73 views2 pages
30 May 2018
School
Course
Professor
CMPS12A Mini-Lecture PA5 Stuff
There are two main functions that need to be completed in order for the program to work as it
is intended. To solve the Queens problem where you input the number of queens on a chess
board and have to find the number of permutations where those queens are not diagonal,
vertical, or horizontal to each other that they can take each other out like in a chess game,
there ill e stati oid etPerutatioit [] A {…} ad stati Boolea is“olutioit [] A {…}.
Of course, there will be other helper functions to make life easier or that are needed for this
assignment.
Some helper functions that might be useful….
static void reverse()
public static boolean isInteger()
static void printArray()
static void swap()
Is up to you to figure out what should go in the parameter list.
You should also know how to parse a variable of one type to another type as well as catch
exceptions. To give you an example:
Example:
public static boolean isInteger (String s) {
try {
Integer.parseInt(s);
}
catch (NumberFormatException e) {
return false;
}
return true;
}
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in

Document Summary

There are two main functions that need to be completed in order for the program to work as it is intended. Of course, there will be other helper functions to make life easier or that are needed for this assignment. Some helper functions that might be useful . static void reverse() public static boolean isinteger() static void printarray() static void swap() Is up to you to figure out what should go in the parameter list. You should also know how to parse a variable of one type to another type as well as catch exceptions. Example: public static boolean isinteger (string s) { try { Integer. parseint(s); catch (numberformatexception e) { return false; return true; To start working on nextpermuation(), we should look at it like this: Example: n = 6 where n would be the max number for the permutations.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents

Related Questions