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

  • Home
  • SEARCH
  • 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 8770065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:29:00+00:00 2026-06-13T17:29:00+00:00

I have been working on a project for school. Basically you have to make

  • 0

I have been working on a project for school. Basically you have to make a script with a couple of scanners. So for instance:

  • Return the corresponding ASCII code from a integer, so from a scanner
  • Return the surface of a sphere by giving a double.

I now want to make a Scanner class for both functions. But 1 has to be an integer and the second has to be a double. How do I make sure wether the function returns a double or an integer.

I am using the follow code:

public static [Heres what goes wrong] vrager (String type, String tekst) {

Scanner vraag = new Scanner(System.in);

System.out.println(tekst);

type variable = vraag.next();

return variable;

So by calling the function would be like: seconden = (vrager("int", "How many seconds?:));

But if I would like to let the function work for also doubles it goes wrong cause the function is not expecting to return doubles.

How can I solve this issue?

  • 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-13T17:29:02+00:00Added an answer on June 13, 2026 at 5:29 pm

    A double can represent every possible int value so return a double.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with a Ruby project for school, and have sadly not been able
I have been working on project, to make a website which read files(c/c++ text
I have been working on a project for my c# class at school. And
I have been working on a project in C# (.net4). Project pretty much allows
I have been working on a project on and off, but I haven't touched
Situation I have been working on a project lately where the UI development seems
So I have been working on this project for a short while now. I
Hey so I have been working on a project that I want to be
I have been working on an opencv project for iOS. I was given a
I have been working on a huge ETL project with 150+ tables and during

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.