Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9212161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:27:39+00:00 2026-06-18T01:27:39+00:00

Im totally new to java and my first task is to make a currency

  • 0

Im totally new to java and my first task is to make a currency calculator from US dollar to NOK(Norsk Kroner). And the program should calculate and show how this amount most effectively can be cashed out i all norwegian paying units. I Have been trying all day, but getting nowhere. Anybody who can help me out with my code?

Heres my code:

/*
 * Valutacalc
 *
 */

import static java.lang.System.*;
import static java.lang.Integer.*;
import static javax.swing.JOptionPane.*;

public class Kalkulator {
    public static void main(String[] args) {
        // Leser verdi fra brukeren
        String tallTxt = showInputDialog("Antall US Dollar");
        int dollar = parseInt(tallTxt);
        double valuta = 5,49;
        // Beregner svarene av regnearbeidet /
        int svar1 = dollar * valuta;
        //Skriv ut resultat
        showMessageDialog(null,   dollar  * " * " valuta " = " + svar1 + "\n");
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T01:27:40+00:00Added an answer on June 18, 2026 at 1:27 am

    replace

    double valuta = 5,49;
    

    by

    double valuta = 5.49;
    

    Because decimal point in java is ‘.’ not ‘,’.

    May be you also want to change type of svar1 to double

    also change:

        showMessageDialog(null,   dollar  * " * " valuta " = " + svar1 + "\n");
    

    to

        showMessageDialog(null,   dollar  + " * " + valuta + " = " + svar1 + "\n");
    

    The hole code:

    public static void main(String[] args) {
        // Leser verdi fra brukeren
        String tallTxt = showInputDialog("Antall US Dollar");
        int dollar = parseInt(tallTxt);
        double valuta = 5.49;
        // Beregner svarene av regnearbeidet /
        double svar1 = dollar * valuta;   
        //Skriv ut resultat
        showMessageDialog(null,   dollar  + " * " + valuta + " = " + svar1 + "\n");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am totally new to Java Mail. I first wanted to execute the program
I'm totally new to Flex (moving away from Java for now :(). I have
I'm new in the Java world and I'm totally confused with the sheer number
im totally new when it comes to trying to make HTML code. I was
I'm totally new to Android (Java) Development and I'm so excited about it! The
I am very new to programming and I am using Java as my first
I´m totally new to programming in java, and following some basic tutorials for my
I am totally new to Java and I've started with some simple console applications.
I am given an assignment but I am totally new to Java (I have
I am totally new to everything in Java and it gets confusing some times,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.