Hello
I am trying to read data from one activity, save it to a file... and when open another activity I will be able to read that file(by opening it).
I searched for tutorials, all they are showing on the same activity. I figured out how the code works.. but I'm not able to understand what will...
Homework Statement
Basically, as the thread title says, I've got to implement a Priority Queue with a Doubly-Linked List in Java.
This is an excerpt from the instructions for the assignment:
I've assumed that priority is given to larger integers (since it wasn't specified in the...
I've got experience with win32API but its' a pain in the ass.
What else is good for cross platform low level programming of apps, want it to work for PC, linux, be able to handle serial data streams, convert data and do C++ tier things.
So far been using processing but that's not powerful...
Hello, I am currently working on a version of Minesweeper that uses Java.
Currently the code seems to work relatively well and the game runs properly, however there is an issue.
I currently have the set to update the board on every mouse click and release, as these are currently the only actions...
Not necessarily for JAVA, but in any beginning computer programming course at a college or university:
What will the school, or department, or the teacher require of the students?
Need the student use their own personal computer for this?
Can student do the work using JAVA without having an IDE...
Hi, I'm trying to study Runge-Kutta method and apply on a simple pendulum.
Using a timestep dt=0.1 (h=0.1) the pendulum increses energy of 1% every period...
while in this site:
https://www.myphysicslab.com/pendulum/pendulum/pendulum-en.html
decreses energy about 0.01%
What am I doing wrong...
This is a homework problem, so I have to follow some stipulations, namely:
The problem is, I have no idea how to get a method to return a generic-type array. Because of type erasure, I can't create an instance T[] of a generic array, empty or otherwise.
The only way I was able to do it was...
I want to learn web programming with Java. I'm using eclipse neon with tomcat 8.5.13. My question is do these tools support asynchronous programming and server push technologies or should I use other tools?
Thanks
I have never done Java but my professor says it is similar to c++. I am trying to convert quicksort in java and covert it to c++.
I don't know if this is correct or not. Here is the code my professor gave us.
.....Java......
public static void quicksort(char[], int left, int right)
{
int...
Hello, I cannot seem to get the calculations correct for my shopping cart to print out the tickets and total how many tickets and how much they are. The first set of code is for the shopping cart the comment sections are for what is suppose to be happening in each section. I have the menu...
I am attempting to create a Sudoku Solving Program in Java
This is what I have to far
https://pastebin.com/raw/tgnAGKb2
I have spent close to an hour trying to debug it but to no avail
Can someone more skilled than I please point me in the right direction?
Hi, I'm developing a very simple solar system simulator for educational purpose.
I had taken from wikipedia mass, velocity of planet and applied universal gravitation formula and applied to all celestial corps. It works well, but when I add the moon... the moon is like a planet, rotating around...
Hello,
I am stuck on this java problem. I was wondering if anyone can figure out what I am doing wrong. Thank you!
Problem
1. Given an array of ints, return true if there is a 1 in the array with a 2 somewhere later in the array.
ex: has12([1, 3, 2]) → true
has12([3, 1, 2]) → true...
I'm having issues with this code, here are the parameters and results.
Create a program using conditional logic and string operations that does the following using your NetBeans IDE and upload it here:
(1) Use scnr.nextLine(); to get a line of user input into a string. Output that line. (1...
Here's the snippet I'm erroring on. I'm sure I have a bad syntax or I'm not relative referencing correctly or something. Null pointer.
xo = new ImageIcon[2][2];
xo[0][0] = new ImageIcon(getClass().getResource("img/x1.png"));
xo[0][1] = new...
I'm working on this code for my programming class and I'm completely stuck. Here is what I have so far but I keep getting error messages.
import java.util.Scanner;
public class TextMsgAbbreviation {
public static void main(String[] args)
{
String BFF ="best friends forever"...
I'm trying to write Strings to files in Java.
Basically, I'm supposed to read from a file containing text (assumed to be strings). For each line of text,
if the String has the format word1 word2 (that is, if it's two words), I have to write it to one file (a list of names), whereas if it...
Hello everyone,
I am new to the forum. Programing was never an interest of mine but it’s an unfortunate requirement for classes I am taking I could really some help. I have tried fixing the code the best I can, but when I run this through Netbeans, no matter what numbers I put in for Wall...
One of my professor's assignments is proving particularly tricky for me. It reads:
"Write the method
public static void sort(String[] a)
that sorts the array a in increasing order. The method must be
a short recursive program. Do not use quicksort or merge sort.
It should be a lot...
Everywhere I read, I see I want this.getContentPane.setBackground(Color);
This doesn't work for me. It didn't on the last project either, and I just let it slide thinking I'd figure it out. Now here I am, same problem. Any help would be appreciated.
Notes:
You might get some "errors". Just...
I am making a simple text editor program. You can load, save and exit, and other things.
I have the loading and saving working, but the exiting is giving me a peculiar problem. In my project, I have a gui class that extends JFrame, and I also have an ExitOption class that extnds JFrame. I am...
Hello,
I am stuck on a Java problem in my textbook. Can anyone help me? I have tried many variations to no avail thank you.
Question:Write code that prints: userNum ... 2 1 Blastoff! Your code should contain a for loop. Print a newline after each number and after Blastoff!. Ex: userNum = 3...
Hello, I'm having trouble with moving an object using an image. I want my image "Car" to move left and right when I press one of the JButtons. As you can see, I included a blue rectangle to kind of show you what I mean by "moving". Here is the code for the Blue Rectangle.
private int carY =...
This is a class assignment that has been puzzling me for a few hours. I need this to print out the values from the passenger array. My code so far prints the values from my aircraft class perfectly but not from my passenger class. Please see my output below:
How do I make the output display...
Hello,
I am writing a program that takes a users input of how many credits they're taking, and the number of dollars each credit is. The book and parking fee is a constant number (no change). I'm using JOptionPane so users can enter 2 values, 1 for number of credits, and the other for dollars...
Homework Statement
I have the following data which I would like to model using an exponential function of the form y = A + Becx.
Using wolfram mathematica, solving for these coefficients was computed easily using the findfit function. I was tasked however to implement this using java and have...
The code I'm working with
import java.io.*;
import java.util.*;
public class ProgressReport{
File file = new File("grades.txt");
Student[][] student = new Student[1][1];
Student[][] add;
int[] scores = {0,0,0,0,0};
String name = "";
public...
this is throwing me an error
while(! isNaN(s.next()))
"The method isNaN(String) is undefined for the type ProgressReport"
s is a scanner.
I'm just trying to tokenize a text doc of the form
int
String int ... int
...
String int ... int
int
String int ... int
...
String int ... int
etc.
Oh yea...
Homework Statement
Essentially, I am expected to have a method that can do a keyword search through my hashmap and return respective results. My hashmap is as follows:
HashMap<String, Person> phonebook
The string as a key is generally the name of the entry. A person object has 3 fields(Name...
< rant >
For ten years I've had a particular program that has only been released in a version to run on Java 6.
That's spanned multiple incarnations of Windows, culminating in Win 10.
The developers still don't seem to realize what a giant PITA barrier-to-entry Java is.
It's ten years later...
I am attempting to find the numbers above the average number of a set of numbers in an array. I am having trouble understanding why my output for the list of numbers above the average is so...weird. I'd appreciate the help!
My code:
public class Inequality
{
public static void main(String[]...
Hi
I need to download Java to open a certain html. I need suggestion of a safe site to download. There are quite a few when I search and I don't want to click on anyone until I know it's legitimate.
Thanks
Hows it going MHB. This is my first post and probably will not be my last. I am not going to come here just asking for answers, but to look for help in my coding adventure. I am currently enrolled into a entry level coding course that kind of just jumps right into things and does give some help...
i wanted to know how to become computer king of world if we have coding talent
like making cool apps,software,making technical software machines like robotics.
can we become computer king by challenging bill gates
like what they did to world
we can do in 1 day
not by copying but following...
i wanted to ask you that in c++it is important we should learn linked list before learning stack,queue that i wanted to know while studying data structures
Hi, I'm currently a Part time CS student that is looking to further advance his java learning. Right now I'm using The University of Helsinki's free CS course to learn java(my own university's course pales in comparison to this resource...) however I'd like to define my path further.
I spend...
Homework Statement
Hi, so I'm working on a project(part 1) where I am supposed to create a simple card game, under a few requirements.
Here are the requirements:
1. Write a method boolean hasFlush(String hand) that checks whether the five-card poker hand given as 10-character string is a...
Homework Statement
[/B]
So my professor has given this as a lab activity. He has not given any sample outputs, other than these simple instructions. I don't actually understand to what extent I'm to perform this activity to.
Write a class BankAccount that contains a double field balance, and...
A user types a word and a number on a single line. Read them into the provided variables. Then print: word_number. End with newline. Example output if user entered: Amy 5
Amy_5
#include <stdio.h>int main(void) {
char userWord[20] = "";
int userNum = 0;
/* Your solution goes here */...
Hi everyone, I've been working on this assignment for a few days now with no luck at all. Would anyone be willing to review this code for me and see if I'm even setting it up right? Here are the directions for the assignment.
1) Use scnr.nextLine(); to get a line of user input into a string...
Simple geometry can compute the height of an object from the object's shadow length and shadow angle using the formula: tan(angleElevation) = treeHeight / shadowLength. Given the shadow length and angle of elevation, compute the tree height.
What I have so far:
import java.util.Scanner...
A user types a word and a number on a single line. Read them into the provided variables. Then print: word_number. End with newline. Example output if user entered: Amy 5
Result should read as: Amy_5
import java.util.Scanner;
public class SpaceReplace {
public static void main (String []...
Compute the acceleration of gravity for a given distance from the Earth's center, distCenter, assigning the result to accelGravity. The expression for the acceleration of gravity is: (G * M) / (d2), where G is the gravitational constant 6.673 x 10-11, M is the mass of the Earth 5.98 x 1024 (in...
Hi, I am trying to analyze the an harmonic oscillator using kinematics.
first i calculate the force applied by the spring (f = (-x)*k)
then i calculate the acceleration (a = f/m)
then speed (v= v0 + v0t + 0.5*a*t^2)
and finally update x (x = x0+vt)
this is a simplfied loop of my program...
Hello mathhelpboards community! I can't figure out how to get my code to execute while using buffered reader and try with resources. :-( I created a data.txt file correctly and it contains the numbers "0.5 3 10 70 90 80 20" without quotes. I added a catch IO Exception utilizing the...
Hello mathhelpboards community! Please help! Thank you. :-)
I need my code to print out the user's original array that is to say the numbers in the way the user entered them. I tried making a copy of the original array and then did all of the arithmetic on it. I sorted the array copy in...
Hi,
I am using NetBeans 8.1. I want to add elements in a list Box on a Button press. My code would read text from textField & then insert into list box:
private void button1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your...
A https://driven2services.com/staging/mh/index.php?threads/18929/ about Java prompted me to ask about graphics in Java and C#, especially from the standpoint of teaching. I know how to create graphical applications in Java using Swing, but I know very little about C#.
Swing applications have a...