import java.util.Scanner; public class Valentine { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String name, look, ethos, character, dress, hairdo; double height, weight; int age; GirlFriend girl = new GirlFriend(); girl.setName("Nugo"); name = girl.getName(); girl.setLook("清新脱俗"); look = girl.getLook(); girl.setEthos("活泼热情"); ethos = girl.getEthos(); girl.setCharacter("积极乐观"); character = girl.getCharacter(); girl.setDress("紧身蓝色牛仔裤"); dress = girl.getDress(); girl.setHeight(1.63); height = girl.getHeight(); girl.setWeight(49.5); weight = girl.getWeight(); girl.setHairdo("高马尾"); hairdo = girl.getHairdo(); System.out.println("输入指令,0退出"); System.out.printf("%s是一个%s的,喜欢穿%s的%s的梳着%s的女孩。", name, look, dress, character,hairdo); System.out.println(""); System.out.printf("身高%.2f cm,体重%.2f kg,非常的%s。", height, weight, ethos); //定义一个死循环,循环获取输入的数据,哈哈差不多 label: while (true){ String a = sc.next(); switch (a) { case "Nugo,今天我们一起去滑雪吧!": girl.playGame(); break; case "快点跟上,小心把你给丢了~": girl.coqutry(); break; case "我帅吗?": girl.speak(); break; case "今天开心吗?": girl.love(); break; case "你怎么哭了?": girl.baobao(); break; case "情人节快乐~": System.out.println("老公情人节快乐~"); break label; } } } } final class GirlFriend { private int age; //这个是年龄属性 private String name; //这个是姓名属性 private String look; //这个是外貌属性 private String ethos; //这个是气质属性 private String character; //这个是性格属性 private String dress; //这个是穿衣属性 private double height; //这个是身高属性 private double weight; //这个是体重属性 private String hairdo; //这个是发型属性 public void setName(String name){ /* 设置名字 */ this.name = name; } String getName(){ /* 获取名字 */ return name; } public void setAge(int age){ /* 设置年龄 */ this.age = age; } public int getAge(){ /* 获取年龄 */ return age; } public void setLook(String look){ /* 设置外貌 */ this.look = look; } public String getLook(){ /* 获取外貌 */ return look; } public void setEthos(String ethos){ /* 设置气质 */ this.ethos = ethos; } public String getEthos(){ /* 获取气质 */ return ethos; } public void setCharacter(String character){ /* 设置性格 */ this.character = character; } public String getCharacter(){ /* 获取性格 */ return character; } public void setDress(String dress){ /* 设置穿衣风格 */ this.dress = dress; } public String getDress(){ /* 获取穿衣风格 */ return dress; } public void setHeight(double height){ /* 设置身高 */ this.height = height; } public double getHeight(){ /* 获取身高 */ return height; } public void setWeight(double weight){ /* 设置体重 */ this.weight = weight; } public double getWeight(){ /* 获取体重 */ return weight; } public void setHairdo(String hairdo){ /* 设置发型 */ this.hairdo = hairdo; } public String getHairdo(){ /* 获取发型 */ return hairdo; } public void playGame(){ /* 打游戏 */ System.out.printf("好的老公,今天天气真不错,记得带相机。"); } public void coqutry(){ /* 撒娇 */ System.out.println("老公你滑慢点嘛,人家害怕啦~~~"); } public void speak(){ /* 说话 */ System.out.println("今天的老公,仍旧帅气迷人,使人家心中好似小鹿乱撞~"); } public void baobao() { /* 跳舞 */ System.out.println("呜呜呜,宝宝摔的好疼啊,抱抱人家嘛~"); } public void love(){ /* 卖萌 */ System.out.println("今天真开心,最爱你了,老公~"); } }
09-13
2858
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
02-24
415
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-14
2570
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)