dghf
JCHJava Community | Help. Code. Learn.
•Created by dghf on 3/2/2025 in #java-help
Thoughts on this ER-diagram?

3 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 3/2/2024 in #java-help
I need to rewrite this Java code while retaining same functionality
7 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 2/24/2024 in #java-help
Can my code be improved?
34 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 6/4/2023 in #java-help
Need help with Strategy pattern for discounts in POS system

23 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 4/30/2023 in #java-help
Implementing UML in Java
Hi everyone,
I am working on a project where I need to implement a UML diagran in Java. I am new to both UML and Java, so I am facing some difficulties in implementing the code.
I have tried to understand the code and have started with creating the classes in Java. However, I am not sure how to proceed with some of the methods, especially the ones related to the Sale and Receipt classes.
I would really appreciate it if someone could help me with this. Specifically, I am looking for guidance on how to implement the Sale and Receipt classes in Java. Any suggestions or examples of how to do this would be really helpful.
Thank you in advance for your help!
5 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 4/26/2023 in #java-help
help me with this

8 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 4/11/2023 in #java-help
Is this correct?
Is this correct?
10 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 12/4/2022 in #java-help
Is this picture an accurate depiction of the code?
5 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 11/10/2022 in #java-help
Can someone help me with this?
Title
4 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 11/9/2022 in #java-help
Integer sequence
Could someone explain for example this
int min = u[1]; int sum = u[1]; for (int i = 2; i < u.length; i++)And this
if (u[i] < min) min = u[i]; sum += u[i];And this
int[] u = new int[10 + 1]; System.out.println("enter 10 integers in a row:"); for (int i = 1; i < u.length; i++) u[i] = in.nextInt();
7 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 11/5/2022 in #java-help
Help
// PersonligaUppgifter.java
// ett program som hanterar personliga uppgifter
/**
Anv�ndaren matar in sina personliga uppgifter. Dessa uppgifter sparas
sedan i en fil.
**/
class PersonligaUppgifter {
public static void main(String[] args)
// throws Exception // (1)
{
System.out.println("PERSONLIGA UPPGIFTER");
System.out.println();
// inmatningsverktyg
java.util.Scanner in = new java.util.Scanner(System.in);
// mata in personliga uppgifter
System.out.print("Fodelsear: ");
int ar = in.nextInt();
// in.nextLine(); // (2)
System.out.print("Ditt fornamn och efternamn: ");
String namn = in.nextLine();
System.out.println();
// spara uppgifter i en fil
java.io.PrintWriter fout =
new java.io.PrintWriter("persUpp.txt");
fout.println(namn + ": " + ar);
fout.flush();
// ett meddelande
System.out.println("Oppna filen persUpp.txt!");
}
}
74 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 11/1/2022 in #java-help
On creating a Java program
0
I am completely new to Java, and I want to start by saying that I am a beginner. I use Macbook.
With that said, I'm going to create, compile and execute a Java program. Don't know if you use the JDK or a text editor called TextPad in Windows, I have Visual Studio Code.
This is what it says in the file with the instructions:
So this is how I first started oon my macbook: https://i.stack.imgur.com/pwf63.png
The error message I get is:
The declared package "" does not match the expected package "Programmering"And I was told that I need to write ”Package Programmering;” at the top. I am not sure why that solves the problem, and why it's not mentiooed in the instructions.
5 replies