1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Afina-wow [57]
3 years ago
7

Using a text editor, create a file that contains a list of at least 15 six-digit account numbers. Read in each account number an

d display whether it is valid. An account number is valid only if the last digit is equal to the remainder when the sum of the first five digits is divided by 10. For example, the number 223355 is valid because the sum of the first five digits is 15, the remainder when 15 is divided by 10 is 5, and the last digit is 5. Write only valid account numbers to an output file, each on its own line. Save the application as ValidateCheckDigits.java.
Computers and Technology
1 answer:
grigory [225]3 years ago
3 0

Answer:

Explanation:

The following code is written in Java. It reads every input and checks to see if it is valid. If it is it writes it to the output file.

import java.io.File;

import java.io.FileNotFoundException;

import java.io.FileWriter;

import java.io.IOException;

import java.util.Scanner;

class Brainly {

           public static void main(String[] args) {

               try {

                   File myObj = new File("C:/Users/Gabriel2/AppData/Roaming/JetBrains/IdeaIC2020.2/scratches/input.txt");

                   Scanner myReader = new Scanner(myObj);

                   FileWriter myWriter = new FileWriter("C:/Users/Gabriel2/AppData/Roaming/JetBrains/IdeaIC2020.2/scratches/output.txt");

                   while (myReader.hasNextLine()) {

                       String data = myReader.nextLine();

                       int sum = 0;

                       for (int x = 0; x < 5; x++ ) {

                           sum += data.charAt(x);

                       }

                       int remainder = (sum % 10);

                       System.out.println(remainder);

                       System.out.println(data.charAt(5));

                       if (remainder == Integer.parseInt(String.valueOf(data.charAt(5)))) {

                           System.out.println("entered");

                           try {

                               myWriter.write(data + "\n");

                               System.out.println("Successfully wrote to the file.");

                           } catch (IOException e) {

                               System.out.println("An error occurred.");

                               e.printStackTrace();

                           }

                       }

                       sum = 0;

                   }

                   myWriter.close();

                   myReader.close();

               } catch (FileNotFoundException e) {

                   System.out.println("An error occurred.");

                   e.printStackTrace();

               } catch (IOException e) {

                   e.printStackTrace();

               }

           }

       }

You might be interested in
1) SuperFetch is a memory-management technique that a) determines the type of RAM your system requires. b) makes the boot-up tim
Ira Lisetskai [31]

Answer:

c

Explanation:

It preloads the apps and softwares that you use most into thr memory so that they can boot up faster.But it consumes more ram.

5 0
3 years ago
What are specific and relevant terms that will help you locate information using an internet search engine?
Liono4ka [1.6K]
I would say A:keywords

Hope this helps

I’m sorry if this is wrong

Have a great day/night
3 0
3 years ago
Brian has created the following selection sort class in Java. In which line is the index of the smallest value returned? In whic
katen-ka-za [31]

Answer:

Explanation:

Since there are no line numbers in this question I will start counting from public class SelectionSort{ as line 1 and so on, as well as provide the code on that line.

The index of the smallest value is returned on line 8 where it says return min which shouldn't have any spaces and should be return minPosition;

The input array is given as an argument at the beginning of the function on line 2 where it says private static int positionMin (int] vals, int startPosition) {, as the variable vals.

This input array is also used as an argument on line 10 where it says Position; private static void swap(int] vals, int firstPosition, int secondPosition) and line 15 where it says vals[secondPosition] temp return public static void selSort(int| vals) {

8 0
3 years ago
Your wireless network consists of multiple 802.11n access points that are configured as follows: SSID (hidden): CorpNet Security
nasty-shy [4]

Answer:

double the bandwidth assigned per channel to 40 MHz

Explanation:

The best way of doing this would be to double the bandwidth assigned per channel to 40 MHz. This will make sure that the capacity is more than sufficient. This is simply because the bandwidth of a channel represents how much information can pass through the channel at any given second, the larger the channel, the more information/data that can pass at the same time. Therefore, if 20 MHz is enough for the network, then doubling this bandwidth channel size would be more than sufficient capacity for the network to handle all of the data.

6 0
3 years ago
Case 2-2 Jack has a computer at home that he uses to access the Internet, store and edit personal photos, and create and edit do
bekas [8.4K]

Answer:

Check button under error checking

Explanation:

Under the Tools tab there are two options:

Error checking and Optimize and defragment drive option.

clicking the check button with administrative permission under error checking option will examine the hard drive for errors.

3 0
3 years ago
Other questions:
  • The ___ is the primary storage device of a personal computer. hard drive RAM ROM compact disc
    6·1 answer
  • Expressing your needs to others is aggressive behavior.<br> True or False?
    5·2 answers
  • Store programming components in the shared folder. you want to secure the data in the folder as follows: members of the research
    11·1 answer
  • Explain how each of the five types of prewriting assist a writer in getting started. please make it short.
    15·1 answer
  • Unless grunkle stan pines is mistaken, there is a family of deer’s in his garden
    6·1 answer
  • The product of two integers is -180 if one of them is 12 find the other​
    14·1 answer
  • Write Tic tac toe program in python for beginners pls
    10·1 answer
  • Page Setup options are important for printing a PowerPoint presentation a certain way. The button for the Page Setup dialog box
    15·1 answer
  • Is pseudocode obtained from Algorithm or is Algorithm obtained from pseudocode?
    8·1 answer
  • Help me with this two questions please
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!