如何从包含名字,姓氏,Test1标记,测试2标记和计算A级学生总体平均值的Txt文件中获取数据 [英] How Do I Get Data From A Txt File Which Contain First Name, Last Name, Test1 Marks, Test 2 Marks And Calculate The Grade A Students Overall Average Like That

查看:71
本文介绍了如何从包含名字,姓氏,Test1标记,测试2标记和计算A级学生总体平均值的Txt文件中获取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从包含名字,姓氏,test1标记,测试2分的txt文件中获取数据并计算A级学生的整体平均值

你能告诉我我我不知道怎么做

解决方案

你提供了足够的信息让我们能够完全建议一种方法 - 例如,每条线上的信息,例如用逗号分隔?



我会



1)编写一个程序来读取文本文件,逐行,并简单地输出到控制台每一行作为其读取

2)当(1)工作,然后,一旦你读取每一行(并假设数据是由逗号即','),将行拆分为字段 - 将每个字段写入控制台



3 ... n取决于您还需要做什么数据



显然,评论,错误处理,关闭文件...



'g'

要添加到Garth的解决方案1,您可以在Java =>中找到如何读/写和解析文本的方法。 用Java读取和编写文本文件 [ ^ ]。

可以找到更多Java编码教程=> 学习Java [ ^ ]


how do i get data from a txt file which contain first name, last name, test1 marks, test 2 marks and calculate the Grade A students overall average like that
Can u please tell me i have no idea how to do it

解决方案

you havnt provided enough information for us to be able to fully suggest an approach - for example, is that information on each line, separated by commas for instance ?

I would

1) Write a program to read a text file, line by line, and simply output to the console each line as its read
2) when (1) is working, then, once you've read each line (and assuming the data is separated by commas ie ','), split the line into fields - write each field to the console

3...n depend on what else you need to do to the data

obviously, comments, error handling, closing the file ...

'g'


To add to solution 1 by Garth, you can find out how to read/write and parse text in Java => Reading and writing text files in Java[^].
More tutorials in Java coding can be found => Learn Java[^]


这篇关于如何从包含名字,姓氏,Test1标记,测试2标记和计算A级学生总体平均值的Txt文件中获取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆