While coding a random program about how Convenient the program was for the user , I use Scanner, and its .nextInt(); to ask the user to rate the program's Convenience: 275.Scanner scan = new Scanner(System.in); 276.System.out.println("Rate the convenience of this program by typing 1 to 5..."); 277.System.out.println("1. *"); 278.System.out.println("2. * *"); 279.System.out.println("3. * * *"); 280.System.out.println("4. * * * *"); 281.System.out.println("5. * * * * *"); 282.int inp; 283.inp = scan.nextInt(); I get the error: Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Unknown Source) at java.util.Scanner.next(Unknown Source) at java.util.Scanner.nextInt(Unknown Source) at java.util.Scanner.nextInt(Unknown Source) at expences.Main.main(Main.java:283)

Member Avatar
Member Avatar
+0 forum 3

Dear , We have an billing script when we enter value on the submition page it will create an recipt number and other details we have entered in the form on the page recipt.php that was the first code. Past year the script was working fine but now it was showing us an error in the concole of our browser "** Uncaught SyntaxError: Unexpected token ;**" We don't know what to do or how to resolve this isse in the recipt.php page was are pushing customer mobile number and an message to **tsms.php** we have included our both codes below …

Member Avatar
Member Avatar
+0 forum 3

hey, i'd like to know if there is a java program that transformate 2D dicom images to 3D dicom images?

Member Avatar
Member Avatar
+0 forum 1

`import java.util.*; import java.time.*; public class Customer import java.util.*; import java.time.*; public class Customer{ private String name; private int custID; static int nextCustID = 100; ArrayList<Rent> rents = new ArrayList<Rent>(); public Customer(String n){ name = n; custID = nextCustID++; } public void addRent(int copyNo, LocalDate date, int days){ Rent r = new Rent(copyNo, date, days); rents.add(r); } public String getName(){ return name; } public int getID(){ return custID; } public void listRented(){ System.out.print("has on rent "); for(Rent r: rents){ System.out.println(r); } } public Rent searchRentByCopyNo(int copyNo){ for(Rent r: rents){ if(r.getCopyNo() == copyNo) return r; } return null; } public void …

Member Avatar
Member Avatar
+0 forum 3

hi i want some change in this code. let one writer, one reader at the same time. Writer has preference. package test; import java.util.concurrent.Semaphore; class ReaderWritersProblem { static Semaphore readLock = new Semaphore(1); static Semaphore writeLock = new Semaphore(1); volatile static int readCount = 0; static class Read implements Runnable { @Override public synchronized void run() { try { readLock.acquire(); readCount++; if (readCount == 1) { writeLock.acquire(); } System.out.println("Thread "+Thread.currentThread().getName() + " is READING"); Thread.sleep(1500); System.out.println("Thread "+Thread.currentThread().getName() + " has FINISHED READING"); readLock.release(); readCount--; if(readCount == 0) { writeLock.release(); } } catch (InterruptedException e) { System.out.println(e.getMessage()); } } } static …

Member Avatar
Member Avatar
+0 forum 3

Hi all, Can anyone help me implement push pop instruction and call recall function in the wombat one program. Im a newbie to these things so it will be helpful if anyone could just take me step by step on what to do. many thanks.

Member Avatar
Member Avatar
+0 forum 1

Hi can anyone help me convert these codes into java and let me know which classes are to have? // Clustering.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <string.h> #include "MersenneTwister.h" #define CATAGORICAL_CONST 30.0 #define MAX_FILENAME_SIZE 500 #define MAX_BUFFER_SIZE 500 #define MAX_STRING_SIZE 100 #define MAX_TOKENS 100 #define MAX_POPULATION 20 #define TOKEN_UNUSED 0 #define TOKEN_LINEAR_INTEGER 1 #define TOKEN_LINEAR_FLOAT 2 #define TOKEN_NOMINAL 3 #define MAX_RECORDS 10000 #define MAX_NUMBER_OF_PEAKS 10 #define FREQUENCY_100 101 #define SAMPLE_SIZE 300 struct Field { char text[MAX_STRING_SIZE]; float value; }; struct Chromosome { int fitness; bool genes[MAX_TOKENS]; }; char InputBuffer [MAX_BUFFER_SIZE]; char Tokens[MAX_TOKENS][MAX_STRING_SIZE]; …

Member Avatar
Member Avatar
+0 forum 3

I'm using android studio to create a multiple choice question app, and i've coded the quiz but so far it just goes on forever. I want to make it so that once the user has answered 20 questions, whether they are right or wrong, the game ends and sends them to an endscreen that I have created, but so far I can't figure out what to do to make this happen. this is what i've tried, it doesn't crash the program but it also doesn't actually do anything. private int round = 0; round = round + 1; if (round …

Member Avatar
Member Avatar
+0 forum 9

Hi guys, I seem to have an issue with a boolean method returining a value. Here is the code excerpt - irrelevant code omitted: public class StreamsTest { public static void main(String[] args) { String[] arr = new String[]{"a", "b", "c"}; //convert array to string with streams List<String> list = Arrays.stream(arr).collect(Collectors.toList()); isElementInIt(list); } static boolean isElementInIt(List<String> list) { if(list.isEmpty()) { return false; } else { for (String string : list) { if (string.contains("a")) { return true; } else { return false; } } } } } STS says that the isElementInIt method should return a boolean value, but it's already …

Member Avatar
Member Avatar
+0 forum 2

Just a quick question, I'm trying to speed up my app and I've seen forum posts where people say reducing the size of pictures speeds up their app. I was hoping to replace my exit cross in the top corner of my app (which is a png because I drew it in a different software) with a shape that I would draw in android studio using xml (draw shape). So would it be better to keep the png or use xml to draw the shape. And if the xml would be better, does anyone know where I could find a …

Member Avatar
Member Avatar
+0 forum 3

//With this method, I input a string and return an array that contains a sorted list of characters as per the frequency. Eg: If i input "apple", the out put should be p,a,l,e, How do I do this? public static ArrayList<Character> characterFreqDist(String statement) { char[] Array = statement.toCharArray(); int length = Array.length; int most_frequent_count = 0; char most_freq_character = '\0'; char[] Final_Array = new char[length]; ArrayList<Character> Sorted_Array = new ArrayList<Character>(); for(int loop = 0 ; loop<length ; loop++) { most_freq_character = '\0'; most_frequent_count = 0; for(int i = 0; i<length ; i++) { char single_character = Array[i] ; int counter …

Member Avatar
Member Avatar
+0 forum 5

Need Help! Here's the first production worker. Exception in thread "main" java.lang.IllegalArgumentException: Multiple decimal separators in pattern "#.##0.00" at java.text.DecimalFormat.applyPattern(DecimalFormat.java:2519) at java.text.DecimalFormat.<init>(DecimalFormat.java:416) at ProductionWorker.toString(ProductionWorker.java:42) at java.lang.String.valueOf(String.java:2826) at java.io.PrintStream.println(PrintStream.java:771) at WorkerDemo.main(WorkerDemo.java:10) Java Result: 1 BUILD SUCCESSFUL (total time: 8 seconds) // Employee Class public class Employee { private String name; private String employeeNumber; private String hireDate; public Employee(String n, String num, String date) { name = n; setEmployeeNumber(num); hireDate = date; } public Employee() { name = ""; employeeNumber = ""; hireDate = ""; } public void setName(String n) { name = n; } public void setEmployeeNumber(String e) { if (isValidEmpNum(e)) …

Member Avatar
Member Avatar
+0 forum 12

/** This code is supposed to take the user input of the length and breadth of the room in one class, get the user input of the material and cost from the other class and calculate the total cost.*/ import java.util.Scanner; //My first class class RoomFlooring { private String FloorMaterial; private double material_cost = 0; public void setFloorMaterial(String FloorMaterial) { System.out.print('\u000C'); // Choosing the floor material Scanner Floor = new Scanner(System.in); System.out.println("Choose your floor material: FancyTile or NormalTile: "); FloorMaterial = Floor.nextLine(); } public String getFloorMaterial() { return FloorMaterial; } // determining the cost according to the floor materials public …

Member Avatar
Member Avatar
+0 forum 4

import java.util.Scanner; class Room_Dimension { private double length; private double width; public Room_Dimension(double length, double width) { this.length = length; this.width = width; } public void setLength(double length) { this.length = length; } public void setWidth(double width) { this.width = width; } public double getLength() { return length; } public double getWidth() { return width; } public Room_Dimension(Room_Dimension roomDimensions) { this.length = roomDimensions.getLength(); this.width = roomDimensions.getWidth(); } public double getArea() { return length * width; } } class Room_Flooring { private String floorMaterial; private Room_Dimension roomDimensions; private double cost_of_material; public Room_Flooring(Room_Dimension roomDimensions, String floorMaterial) { this.roomDimensions = roomDimensions; this.floorMaterial = …

Member Avatar
Member Avatar
+0 forum 1

Hi, how do I sort the string in alphabetical order? find most occuring character("blablabla") remove most occuring("aaa") input: blablabla output: "aaa"

Member Avatar
Member Avatar
+0 forum 1

Hey!!!!I'm looking for the perl to java conversion!!!! Can Someone please help me with the snippet!!!! As soon as possible!! Its very important!!!! my @hosts = get_hosts_ips_bymkt(); for(my $i = 0; $i < scalar(@hosts); $i = $i + 1){ my $ssh_true = eval { Net::SSH::Perl->new($hosts[$i]) }; // # $success = $ssh; // # print "ssh=".$sucess; if($ssh_true){ $Lsmr_IP = $hosts[$i]; print "Lsmr_IP=".$Lsmr_IP."\n"; last; }else{ $Lsmr_IP = $hosts[$i]; print "Ip ".$Lsmr_IP." Is not connecting; trying next"; } } print "Lsmr_IP=".$Lsmr_IP."\n"; } my $ssh_lsm = new Control::CLI(Use => 'SSH', Prompt => ']', Errmode=> 'return', Timeout=> '30', Dump_log => "ts.dump.log"); my $Lsmr_Connect = $ssh_lsm->connect(Host …

Member Avatar
Member Avatar
+0 forum 1

A palindrome is a phrase that reads the same forwards as it does backwards. For example, “a man, a plan, a canal, Panama,” is a palindrome. Write a program that uses a stack data structure to check for palindromes in each line of a text file. Test your program on the following example text file, A man, a plan, a canal, Panama. This line is not a palindrome Don't nod The next one might be my favorite Taco Cat! Another non-palindrome Rats live on no evil star. If your program finds this line, it's not working Neil, a trap! Sid …

Member Avatar
Member Avatar
+0 forum 19

Are there any differencies between these two code ? if (!a.equals("")) { editDate.setText(a) } and if (a!="") { editDate.setText(a) }

Member Avatar
Member Avatar
+0 forum 1

Hi guys so I was playing with some code which would determine the whether a string is a palindrome or not. Its been a mixed bag of results with some palindromes being detected while others aren't. I do apologize to the lack of polish of my comments but I hope that someone might be able to see where the error is and give me good feedback. I think the error is in the set of code that removes the special characters from the string. As a reference, I am using this webiste: http://www.palindromelist.net/ as the source for the palindrome strings. …

Member Avatar
Member Avatar
+0 forum 7

Hi everyone! i'm new to binary trees, and i wanted to write a method to find out how many nodes have bigger values than an integer n!! Any help would be appreciated :) ishi xx

Member Avatar
Member Avatar
+0 forum 1

I have an assignment doing a constructor that accelerates and brakes the speed of the car (among other non-troublesome things) but when I run the program, the speed stays constant and spits out whatever the original number is rather than raising and lowering by 5 like I want it to. I will be eternally grateful to whomever can help me see the error of my ways

Member Avatar
Member Avatar
+0 forum 3

Hi everyone, I'd like to ask you all to help me with this two questions and I've been faced recently, 1.What would be the algorithm which takes the pointers of two Binary Search Trees roots, if equal returns true if not FALSE. (both BSTs are the same as well as the corresponding nodes.)? 2. how many times does " cout " execute? int m=0; for(int i=1; i<=n; i++) { m=m+i; for(int j=1; j<=m ; j++ ) cout << j; } thank you all for you helps and replies in advance.

Member Avatar
Member Avatar
+0 forum 1

hello. I need some help in java 1.The program browse the filename of the text file to be counted 2.The contents of the file will be stored to a temporary storage. 3.Identifies if the c source code in a form of text file is physical lines of code, blank lines of code, comment lines of code and logical lines of code. 4. Counts the number of ploc, bloc, cloc and lloc. 5. Display the content in a text field. 6. The displayed output will be the identified lines of code and the number of counts in each ploc, bloc, cloc …

Member Avatar
Member Avatar
+0 forum 1

Does anyone know about robovm??? It is a platform to make ios apps in java. I need it for a new project I´m working on in a nearshore outsourcing company.

Member Avatar
Member Avatar
+0 forum 9

I am on the latest version of Windows 10, running with SWI-Prolog 7.6.4, and trying to get JPL (Java <->Prolog) running for a school project. I've not had to deal with path issues much but I have done my best to understand the problem. I've added the necessary import statements to my java class file, and the necessary environment variables to my system as per the page here: https://jpl7.org/DeploymentWindows However it *still* does not show up as a valid java package. I've just realized as I write this that maybe I need to reboot. I will try that after posting …

Member Avatar
Member Avatar
+1 forum 4

In Java, is it possible to have Interface in Inner class?

Member Avatar
Member Avatar
+0 forum 2

I am testing my Library class and the addItem method is not adding an item to the arraylist import java.util.ArrayList; public class Library { /** * itemList contains the List of all items in the library. */ private ArrayList<Item> itemList = new ArrayList<Item>(); Item item = new Item(); // Empty Constructor public Library(){} /** * Add a new item to the list of library items. * @param newItem The new item to be added to the list. */ public void addItem(Item newItem) { itemList.add(newItem); } The testDriver has this method Library str = new Library(); ArrayList itemList = new ArrayList(); …

Member Avatar
Member Avatar
+0 forum 1

# I want to give a button in my JSP page, which on click of it should store an image in the filesystem. # Following is the code ScreenCapture.java which is a servlet. Purpose: To capture the screen of working area and store it in file system. Problem: - An image file is stored in file system with blank image. ## Please help me to fix what is wrong ## . import java.awt.Dimension; import java.awt.Rectangle; import java.awt.Robot; import java.awt.Toolkit; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import …

Member Avatar
Member Avatar
+0 forum 3

Hi, I have a problem, because I have a list, in which I'd like to be able to add and remove components, but in other thread I use components from this list. Is there a safe way to operate over this list? Would using synchronized functions (one for drawing, one for modifying help?

Member Avatar
Member Avatar
+0 forum 5

Why much time is needed to access an applet having swing components the first time?

Member Avatar
Member Avatar
-1 forum 4

The End.