创建一个会标应用程序。 [英] Create a monogram application.

查看:84
本文介绍了创建一个会标应用程序。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

程序将显示小写的第一个首字母,大写的最后一个首字母和小写的中间首字母。

Monogram

输入你的名字:Adam James Williams



你的会标是:

aWj



我的尝试:



import java.util.Scanner;

public class Monogram

{

public static void main(String [] args)

{

扫描仪输入=新扫描仪(System.in);

System.out.println(输入你的名字:);

String word = input.nextLine();



int x = word.indexOf();

String first = word.substring(0,1);

String last = word.lastIndexOf();

String middle =;

System.out.println(第一个+最后+中间);

}

}

The program will display a lowercase first initial, upper case last initial, and lowercase middle initial.
Monogram
Enter your name: Adam James Williams

Your Monogram is:
aWj

What I have tried:

import java.util.Scanner;
public class Monogram
{
public static void main (String [] args)
{
Scanner input = new Scanner (System.in);
System.out.println("Enter your name: ");
String word = input.nextLine();

int x = word.indexOf(" ");
String first= word.substring(0,1);
String last = word.lastIndexOf();
String middle = " ";
System.out.println(first + last + middle);
}
}

推荐答案

你将学习很多fa遵循教程,而不是在这里提出基本问题。转到 Java™教程 [ ^ ]并使用免费信息。
You will learn much faster by following the tutorials, rather than asking basic questions here. Go to The Java™ Tutorials[^] and make use of the free information.


以笔开头论文并在论文中写下核心算法。

只有在构建了这个算法并理解它之后,你才能在代码中实现它。只是在没有全局了解过程的情况下抛出几个java语句就不会引导你到任何地方;你必须能够自己做一些事情才能让计算机为你做这件事。

尝试一下,它可能没有你想象的那么困难。



我不想在这里受到伤害,我只是想睁开眼睛,看看开发与随机和机会无关。如果你得到了,那么你可能会喜欢它。你甚至可以在这里找到一些很好的帮助;但没有人会为你做功课。最重要的是,这对我们来说是不专业的。
Start with a pen and paper and write down the core algorithm on the paper.
Only when you have built this algorithm, and understood it, then you will be able to implement it in code. Just throwing a couple of java statements without a global understanding of the process will not lead you anywhere; you have to being able to do something yourself to be able to ask a computer to do it for you.
Try it, it may not be as difficult as you think.

I'm not trying to be harsch here, I just want to open your eyes on the fact that development has nothing to do with random and chance. If you get that, then you may enjoy it. You may even find some great help here; but no one will ever do your homework for you. Most of all, it would be unprofessional from us.


这篇关于创建一个会标应用程序。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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