Hi everyone
I'd like to set an ImageView background for a menu screen that uses ScrollView, ConstrainedLayout and Radio Buttons. This is possible if I hardcode the width and height of the ImageView, but I don't want to do this because it might ruin the formatting on some models of phone.
I'd...
Hi everyone
I've used a game loop to try make a textView alternate between two different strings every two seconds. When I run it, I just get a blank screen. The textView was originally set to show "Hello World!" but not even that shows.
Does anyone know what's gone wrong?
Thanks
public...
Hi everyone
I'm making a Whack-a-mole-style game for learning katakana. I have a textView for the question, a textView for the answer and nine buttons.
I have a SetQuestion runnable to show the question and answer. Each button has its own runnable that controls how long the button flashes...
I encounter this issue when trying to make this program in Java.
My first input is a number n to indicate how many lines of input for Java to expect next. For each of my next n lines of input, it is in this format
'name value', e.g 'bolt 9.58'. Then for each line, I want java to append the name...
//program showing an advantage of using arrays
public class Arr3
{
public static void main(String []args)
{
System.out.println("There are 31 days in the month of Jan");
System.out.println("There are 27 days in the month of Feb");
System.out.println("There...
Hi everyone
Could someone show my the correct way to use a recursive runnable? The example I have involves the invokeLater method from SwingUtilities.
public void mousePressed( MouseEvent e )
{
Runnable runnable = new Runnable( )
{
public void run( )
{...
Hi everyone
I got the code below from YouTuber, Bro Code. It prints "Hello" every time you click on the button.
I wanted the button to print "Hello" while it was held down and stop printing as soon as the button was released, so I changed this line
if(e.getSource()==button)
to...
https://earthquake.usgs.gov/earthquakes/eventpage/us7000ir9t/executive
M 5.6 - 18 km WSW of Ciranjang-hilir, Indonesia
2022-11-21 06:21:10 (UTC)
6.853°S 107.095°E
10.0 km depth - relatively shallow
https://earthquake.usgs.gov/earthquakes/eventpage/us7000ir9t/region-info
City of Cianjur had...
I already wrote the regToByte method, but I don't understand how to write the makeI and makeR methods correctly.
Create a mini-Assembler for a 32-bit MIPS processor; Program should accept input lines from the user until HALT is read. With each line, translate the line into MIPS machine code...
I succeded to do the first method, but I could not do the second one.
The first method:
public static Node<int> Delete(Node<int> lst, int num)
{
Node<int> p = lst.GetNext();
for (int i = 1; i < num; i++)
{
p = p.GetNext()...
I could not understand the question, I have really tried to solve it but I could not.
I will appreciate any direction to the solution. Thanks in advance:)
By default, I had Java 7 installed on my system(X64, Fedora 20).
I needed Java 6 for a software, hence had to remove 7
sudo yum remove *java*
And then, I installed Java 6.
This installs Java 6 successfully. but the java compiler, JavaC is missing. For that, I try -
su -c "yum install...
I am the beginner in learning to write Java programming commands. In the attached picture the output didn't show my name and surname. I don't understand what was wrong? Would anyone explain here?
int bd= 15;
int ad= 5;
while(ad!=9){
System.out.println(bd);
ad++;
bd++;
}//output 15,16,17,18
do {
System.out.println(ad);
ad++;
}while(ad<=9);//output 5,6,7,8
thanks for the help
I have taken the variables as follows:
A[][]=the matrix
max=to store the maximum integer value present in the matrix
min=to store the minimum integer value present in the matrix
sum=to store the sum of boundary elements
display()=methos to print matrix
sort()=method to sort matrix in descending...
This is actually for my new Android app. But everything is written in Java and SQL; there is almost nothing that is specific to Android.
I have a database, and the following three tables are of interest here:
itemEntity with columns:
itemID: integer primary key
itemName: String; indexed to be...
Is it possible to bring it into this shape using the gridlayout?
I use empty label to add this empty gridThis is my code:import javax.swing.*;
import java.awt.*;
public class test {
public static void main(String[] args) {
JFrame frame = new JFrame()...
Right now I am learning coding on Java using IntelliJ IDEA. I have coded before on C++ and then Python, so I understand a little on Java. I'm not really sure how exactly I would change code so that it would read input from the terminal? Would I have to use a Scanner for this? I can post the...
Summary:: I have recently started with data structures in java and I tried doing this Program .But I have few confusions.
1.How do I write the main() of the program?
2.What are we supposed to do with the value returned by function pop()?
If anyone could point out if there are any errors and...
My current attemp is:
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class TextAnalyzer {
private int lineCount;
private int wordCount;
private int[] frequencies = new int[26];
public int...
Summary:: I'm having problem with this source code.we need to find the frequency of the number of words beginning with an UPPERCASE Alphabet in a sentence.
The data members and member method must be according to the question given in the document.
though i could compile it but it's giving...
here the class name is test153 sent is the sentence entered l is the length of the sentence w is the variable storing each word temporarily before printing.
although we cannot change the syntax of the main() method but programmer does create main() everytime in the program.so i want to ask if it should be pre defined method.
here is the portion of code
[Code tags added by the Mentors]
public void addPosition(String name, String skillNames) throws ApplicationException {
Position ps=new Position (name); //creating object position
if(listaPosizioni.get(name)==null) { //checking if position already present...
Python based course or java course ?. I will be taking an introductory computer programming course . One is python based and the other is java based. The java based course has 2 semesters and goes more in depth with programming . Would it be useful to just take the java courses and get the...
I am writing a class called "Course" in Java so that one can input students names, etc. Here is my relevant code for the Course class:
public class Course {
private String courseName;
private String[] students = new String[0];
private int numberOfStudents = 0;
public...
Hello folks,
I am working on Java program just for fun to model an n-body problem using 3-dimension graphics. I'm looking for a way to speed up the model.
Suppose for example that I decide to increase the speeds of all objects by a factor of, say, 2. To compensate, I would also increase the...
So far, I have implemented the code below, using Java Priority Queues and Maps. I tried to identify each customer by the time they came in (ranging from 360 and onwards) and their grades. However, this is my first time using priority queues and maps, and I am not very sure if I'm doing things...
So in the class TJTwitter, I have the following defined:
private Twitter twitter;
private PrintStream consolePrint;
private List<Status> statuses;
private List<String> terms;
private String popularWord;
private int frequencyMax;
and in the same class, I have a few methods that are meant to...
Edit: Never mind guys, figured it out. I needed to use s.equals :)
However, could someone explain to me why we can't use == on a technical level?
I'm curious to know on a technical level.
Hi guys
Doing a bit of programming, and I'm not too sure why I'm not getting the expected results.
Below...
I had JDK 12.0.1 for some time and recently upgraded to JDK 13.0.1. During the installation, this screen was shown:
I know that newer versions of JDK have no accompanying separate JRE; the standalone JRE currently available is 1.8.0u231. But what is the story about this "private" JRE? How to...
Lets say I have experience creating ML models in Python, and have decided on training my models on Spark using Pyspark. This will form part of an ML infrastructure for a website with a Java or C# backend. How can I make this work? I am a beginner when it comes to Spark.
I am looking for any...
I'm trying to run this java applet on this website: http://astro.u-strasbg.fr/%7Ekoppen/discharge/discharge.html
But the security settings in java doesn't allow it. I have added the website as exception in the java control panel, but it is still being blocked.
How to run this java applet?
I'm interested in quantum programming. So far I've managed to use Java and Python inside Datamelt computation project for physics simulations and for various statistical plots. Now I want to make a simple code that illustates quantum computing, and maybe even to visualize its principles (for...
Hello all:
I am reading a comutacomputa physics book and trying a code from it in MATLAB it is not working and due to my lack of knowledge in this field I can't see where is the mistake hope you can take a look
import java.lang .*;
public class Motion {
static final int n = 100000, j =...
Greetings!
Hey guys, I need help on how can I get pixel value of an image with pixels more than 100px (10x10).
Here the code that I execute in order to get the pixel value
try{
File f = new File ("input image location");
BufferedImage img = ImageIO.read(f)...
Homework Statement
There is a square and a circle is inscribed inside. Simulate an experiment where raindrops drop on this surface. Some raindrops can drop in or on the border of the circle. Some can drop outside the circle. The area of the square divided by the area of the circle gives you pi...
For the life of me, I can't figure out why my program won't update the index variable. I've tried setting the index to 0, and then to -1, and to the size of the arrayList - 1. I'm trying to use the index to get the previous and next flashCard in the arrayList to show up.
I have been working on...
I am trying to get two different menus to show up depending on whether the User is a learner or an admin. However, I'm having some difficulty with the program and the execution. I would appreciate any help or suggestions.
I don't know how to access a user to figure out if it's a learner or an...
Hi,
I am trying to access Excel Sheet .xlsx files in Java. I have tried various options available from internet. My program is using following jar files:
poi-ooxml-3.5-beta4.jar,
openxml4j-1.0-beta.jar
I have done following imports:
import java.io.*;
import java.io.File;
//import...
I have seen that in many cases, teachers and authors prefer Scanner to BufferedReader for taking input from the user through keyboard.
I have found two reasons for this:
1. Scanner class manages exceptions implicitly, while for BufferedReader, exceptions have to be handled either by try..catch...
Hello everyone!
I'm working on a simple app for a project at the university and I'm having problems accessing the SQLite data in RecyclerView. I suspect that the problem lays in a connection with an activity that includes the RecyclerView and the RecyclerView adapter itself.
My project, in the...
Hi all,
I have the code below with a 'for' loop. I see the output is 17, the sum of all elements of the (variable?)
result. I am a bit confused: I cannot tell which part of the code is used to determine that the values
{1,2,10,4,5} must be added to each other?
Please comment/correct:
1)We define...
Hi All,
Teaching myself Java programming from 0. I used some online forums. Now I would like to work, programming on my own PC, i.e., not just as a client . What are good IDEs for Database Dev work? I have been recommended Atom .
It is about five months since Java 9 was released (JDK 9.0.1 October 17, 2017) and while developers and other users of Java try to keep up to pace with its new features - while others are just adopting Java 8, Java 10 is out! So, I thought that it would be useful for anyone developing / using /...
I am having a hard time implementing comparing a given String name with the names of the Dog objects in my binary Search Tree.
The problem comes from my containsRecursive() method. I need to use a String name to find if the name is already in my Binary Search Tree.Here's what I've tried...
This year I made a resolution to by the end of summer build an Android app for my Uncle’s bussiness (Rent-a-Car) which would help him organise the dates of booking a car. I have previous programming experience with C and C++ but not with app creating.
The idea for the app is really simple but...