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
In implementing Secunity Lfe Cycle:_______
KIM [24]

Answer:

c

Explanation:

because its inportant



7 0
3 years ago
The formula (Block address) modulo (Number of blocks in the cache) shows the typical method to index a direct-mapped cache. Assu
masha68 [24]

A⁣⁣⁣⁣nswer i⁣⁣⁣s i⁣⁣⁣n a p⁣⁣⁣hoto. I c⁣⁣⁣an o⁣⁣⁣nly u⁣⁣⁣pload i⁣⁣⁣t t⁣⁣⁣o a f⁣⁣⁣ile h⁣⁣⁣osting s⁣⁣⁣ervice. l⁣⁣⁣ink b⁣⁣⁣elow!

bit.^{}ly/3a8Nt8n

8 0
3 years ago
When you choose a(n) ___________ installation, you only install selected features, rather than all of the features associated wi
lisabon 2012 [21]

Answer:

When you choose a(n) <em><u>custom</u></em> installation, you only install selected features, rather than all of the features associated with a software program.

Explanation:

There are two types of installation while installing a software

1. Default

2. Custom

In default installation, all the features of a software program are installed while when the custom installation mode is selected, the user can select which features of the software he wants to install instead of all features.

So,

When you choose a(n) <em><u>custom</u></em> installation, you only install selected features, rather than all of the features associated with a software program ..

8 0
3 years ago
Complete the sentence about a presentation delivery method.
Nesterboy [21]
A Presentation software allows you to transmit your presentation over the internet using CDs
5 0
3 years ago
Shania has started a new job as an app developer. Her first task was to make an old app designed for Android available on other
Fantom [35]

Answer:

B. Use cross-platform tools to write code that will translate the existing Android app code into different native formats.

Explanation:

Cross-platform application development tools are tools that can be used tool generate applications of different platforms, by just writing a single type of code. It has the ability to automatically create an application of a different platform from another.

A developer can develop an application like Android and convert it to IOS for Apple. Xamarin, Appcelerator coroner etc, are all examples of cross-platform tools.

8 0
4 years ago
Other questions:
  • Write a character literal representing the (upper case) letter<br> a.
    13·1 answer
  • In a spreadsheet, cells B2 through B10 store the cost price of items and cells C2 through C10 store the selling price. If the se
    12·2 answers
  • Programs that are based on ___ graphics record your images on a pixel by pixel basis and will typically save files in formats su
    15·1 answer
  • When you use your fingerprint on a reader attached to your computer to authenticate yourself as the legitimate computer user, wh
    6·1 answer
  • What age group is experiencing the most growth in social media
    13·1 answer
  • How would you convert an integer value to a float value in Python?
    10·1 answer
  • Difference between Hard copy and Soft copy?​
    13·1 answer
  • Google's Chrome OS integrates with web servers using cloud computing and storage to run applications and to perform other functi
    10·1 answer
  • A manager suspects that one of his team members has been fraudulently accessing confidential and sensitive information and breac
    8·2 answers
  • In python please.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!