My professor is a man who enjoys making his students form large, but often simple symbols with smaller letters. That might not have clarified much, so let me demonstrate:
VVVVVVV
VVVVV
VVV
V
Or...
X X
X X
X
X X
X X
Or lastly...
O
O O
O O
O O
O
My problem is, that I've always been bad at figuring out the logic behind these.
I can kinda' see it (somewhat) in my head though... I'd need a double for-loop which depend on the sizes, one that monitors the spaces and one that monitors the symbols, with some conditionals in there. How to make symbols like this, using letters, in Java.
I need to write a program that checks whether a Java source-code file has correct pairs of grouping symbols and the program must implement the Stack<E> class to solve this problem.
Here is the file: [a({b,c}x{d,e})%x] (1+(2-3)/4+[(a-({b+c}*5)/2)+e] (a{b(c]}a)
I tried something like this, but I'm not exactly sure what I am doing wrong:
import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; import java.util.Stack; public class Driver {
I am not sure how to add all the possibilities of elements in an array and find the greatest sum. I want to do this recursively. I don't need any code. How I would do it.
I am trying to iterate through all combinations of characters given a length n with the added notion that all characters are numerical (0-9).e.g I have been given n = 5. The I want to iterate through all combinations starting with "00000" and ending with "99999". My first instinct was to just have a for loop like the following:
for(int i= 0; i<99999; i++){ // extra code here }
but obviously this does not a account for combinations such as "00010".
i am trying to turn an int number etc. 6 into 6 symbols the result would be "------". how can i transform int=6 into "------"? what function do i have to use to do this count?
public class Diagram { public static void skrivDiagram() { Random rand = new Random(); int[] frequency = new int[13]; {
for (int roll = 1; roll <= 100; roll++)
[code]....
Here i want to transform the frequency[face] into "-".
(A) Restrict the number of output values per line to 3 numbers, (B) Remove Duplicate lines, where the same numbers are duplicated just outputted in a different order. (C) Count the number of outlines (D) Add a fixed column to the outputs that has an ascending count from 1 upwards
I'm trying to achieve. The code is as follows:
package num.com.t1; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; /** * * */ public class NumComT1 { public static void main(String... args) {
import java.util.Scanner; public class Exercise1{ public static void main(String[] args) { String employeeName, employeeNumber, position, department ; double otpay, salary, deduction, hrs, rate ; Scanner input = new Scanner (System.in);
[Code] ....
That's my codes but its wrong according to our prof. it should be in frame form. i don't know how to do it since i did not encountered framing since i was started in java.
I have a form containing several fields, 2 of which persist to different table in a database than the rest of the fields on the form. I have no problem persisting the data into both tables of the database, and after the form is submitted I reset the form to its default values. That all works fine.
But in the same session, when I open another form (a search form) and enter search criteria, which then displays a datatable containing the search results, those 2 values that are persisted to another table are not showing up, but the rest of the data is.
Here is the method that calls the persist methods:
@ManagedBean(name = "foreignPartyController") @SessionScoped public class ForeignPartyController implements Serializable { ... public void saveData() {
[Code].....
The values do show up, but the problem is, when a subsequent form is opened in the same session (e.g. a search form) the field for that value shows the actual value, instead of the field being blank.'
I am not sure why the data from the one database ("parent") is showing up, yet the data from the other database ("child") is not.
Is it something I am doing wrong? I thought by setting the setter in the child controller class back to a new instance of the Entity class (PolicyPayment) that it would reset the form to default values, but at the same time retain (or save) the inputted values in the same session.
I have a button on UI which adds messages and when the user clicks on it the form gets submitted, meanwhile the user is clicking on refresh(F5) multiple times which is causing the same message to be displayed multiple times. To resolve this , I am converting the form from a synchronous submit to Asychronous but it is still not working. Below is the code:
I can't figure out why my code doesn't work. My task is to replace for example ä=>ae, using this method String.charAt(int index). So here is my code:
public class pich { public static void main(String[] args) { String text = "Die süße Hündin Leica läuft in die Höhle des fülligen Bären "+ "Iliyan (ein Übergrößenträger), der sie zum Teekränzchen eingeladen hat."+ " An ihrem Öhrchen trägt sie modisch eine Ähre."; String textOhneUmlaute = "";
[Code] ....
when I launch my code I get the same String and nothing has changed
I tried this but it only gives me one letter that corresponds to the number
package pkg2911homework.pkg1; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner keys = new Scanner(System.in);
While using generics, are there cases when ? wildcard cannot be replaced with letters [A-Z]? So far , I was able to find only one case, it is when you want to have field pointing on generic instance without making class generic.
class OneClass { private LinkedList<?> myLL; }
In case above, as I understand, you cannot use [A-Z] without generalize OneClass. Are there any other cases, when there is no way except to use ? wildcard instead of letter [A-Z]?
I have devised a simple program that reads a file and then adds up al the integers in the file and print the result, for example if the file had the numbers 1 2 3 4 5 6 7 8 9 10 then the program would print 55
However i have trouble when non integers are put into the file for example if it was 1 2 3 string 4 5 6 test 7 8 9 10
then i get:
Exception in thread "main" java.util.InputMismatchException at java.util.Scanner.throwFor(Scanner.java:840) at java.util.Scanner.next(Scanner.java:1461) at java.util.Scanner.nextInt(Scanner.java:2091) at java.util.Scanner.nextInt(Scanner.java:2050) at Week7.Task3.filereader(Task3.java:25) at Week7.Task3.main(Task3.java:14)
my code is as follows
package testing;
import java.util.*; import java.io.File; import java.io.IOException; public class summingInts { public static void main(String[] args) throws IOException { Scanner textfile = new Scanner(new File("intSum.txt"));
I had to write a program for class using the method definition "public static char getNumber(char upperCaseLetter)" It compiles and runs but wont print out my final answer.
import java.util.Scanner; public class Phone_0104730303 { public static char getNumber(char upperCaseLetter) { char return_val = 0;
I have made a program, where the user types in a letter M, C or I to identify their major, if the user types m, c or i, my code does not work.
How could I make my program ignore if the letter is upercase or lowercase? My code is posted below. Can I do this in any easier way then adding this type of code for each lowercase letter?:
Java Code:
if (s.charAt(0) == 'm') System.out.print("Mathematics "); mh_sh_highlight_all('java');
My current code:
import java.util.Scanner; public class c4e18 { public static void main(String[]args){ Scanner input = new Scanner(System.in); System.out.print("Enter two characters: "); String s = input.nextLine(); if (s.charAt(0) == 'M')
I am trying to make a program that reads a word and display if the letters are in ascending order or not in ascending order(All kind of letters, capitals ). I have made a code but its not 100% correct. My code:
class Main { public static void main(String args[]) { System.out.print( "#Enter text : " ); String text = BIO.getString();
I am trying to sort out all lower case letters out of my text file into a new file. I am not very good with char values. My text file that is being read says
I've created a class that extends FilterReader, that is to be used to find certain sequences of letters. I plan on using this code to demonstrate an observer, observable design pattern later on. Here is my code:
import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.FilterReader; import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.util.Arrays; public class CaroReaderV2 extends FilterReader {
[Code] .....
Now my question is, how do I go about testing this in a main class? How would I pass in a reader to the constructor? How would I make sure that everything is working correctly?
I want to make a method that takes a word and then checks if the word can be created from available letters. For example, if a word "johnson" can be created by using letters "jashoqwnon".
Now my goal is to make sure that if available letters contain a letter from the word, that letter is put into a String called result and then erased from the list of given letters. So, "johnson" and "jashoqwn" would produce the result "johns" and leave "aqw" unused.
Now the problem that I am facing is that I can't get Java not to use the same letter twice. So "johnson" and "jashoqwn" still gives "johnson".
I've tried everything in my power but I am missing something. Here is my code.
public static String makeAWord(String word, String letters){ String result = ""; for(int i = 0; i < word.length(); i++){ for(int j = 0; j < letters.length() ; j++){