Java语言程序设计与数据结构(基础篇)课后练习题 第十一章 (一)

最后

既已说到spring cloud alibaba,那对于整个微服务架构,如果想要进一步地向上提升自己,到底应该掌握哪些核心技能呢?

就个人而言,对于整个微服务架构,像RPC、Dubbo、Spring Boot、Spring Cloud Alibaba、Docker、kubernetes、Spring Cloud Netflix、Service Mesh等这些都是最最核心的知识,架构师必经之路!下图,是自绘的微服务架构路线体系大纲,如果有还不知道自己该掌握些啥技术的朋友,可根据小编手绘的大纲进行一个参考。

image

如果觉得图片不够清晰,也可来找小编分享原件的xmind文档!

且除此份微服务体系大纲外,我也有整理与其每个专题核心知识点对应的最强学习笔记:

  • 出神入化——SpringCloudAlibaba.pdf

  • SpringCloud微服务架构笔记(一).pdf

  • SpringCloud微服务架构笔记(二).pdf

  • SpringCloud微服务架构笔记(三).pdf

  • SpringCloud微服务架构笔记(四).pdf

  • Dubbo框架RPC实现原理.pdf

  • Dubbo最新全面深度解读.pdf

  • Spring Boot学习教程.pdf

  • SpringBoo核心宝典.pdf

  • 第一本Docker书-完整版.pdf

  • 使用SpringCloud和Docker实战微服务.pdf

  • K8S(kubernetes)学习指南.pdf

image

另外,如果不知道从何下手开始学习呢,小编这边也有对每个微服务的核心知识点手绘了其对应的知识架构体系大纲,不过全是导出的xmind文件,全部的源文件也都在此!

image

本文已被CODING开源项目:【一线大厂Java面试题解析+核心总结学习笔记+最新讲解视频+实战项目源码】收录

需要这份系统化的资料的朋友,可以点击这里获取

class Faculty extends Employee {

private String OfficeTime;

private String PostGrade;

public Faculty() {

}

public Faculty(String Office, double salary, String OfficeTime, String PostGrade, String name, String address,

String number, String Email) {

super(Office, salary, name, address, number, Email);

this.OfficeTime = OfficeTime;

this.PostGrade = PostGrade;

}

public String getOfficeTime() {

return OfficeTime;

}

public void setOfficeTime(String OfficeTime) {

this.OfficeTime = OfficeTime;

}

public String getPostGrade() {

return PostGrade;

}

public void setPostGrade(String PostGrade) {

this.PostGrade = PostGrade;

}

public String toStringOfAllInforation() {

return “Faculty is inforation:PostGrade:” + getPostGrade() + “\tOfficeTime:” + getOfficeTime() + “\tSalary:”

  • getSalary() + “Office:” + getOffice() + “\tName:” + getName() + “\tAddress:” + getAddress()

  • “\tNumber:” + getNumber() + “\tEmail:” + getEmail();

}

@Override

public String toString() {

return “ObjectByFaculty–>” + “Name:” + getName();

}

}

class Staff extends Employee {

private String Post;

public Staff() {

}

public Staff(String Office, double salary, String Post, String name, String address, String number, String Email) {

super(Office, salary, name, address, number, Email);

this.Post = Post;

}

public String getPost() {

return Post;

}

public void setPost(String Post) {

this.Post = Post;

}

public String toStringOfAllInforation() {

return “Staff is inforation:Post:” + getPost() + “\tSalary:” + getSalary() + “Office:” + getOffice() + “\tName:”

  • getName() + “\tAddress:” + getAddress() + “\tNumber:” + getNumber() + “\tEmail:” + getEmail();

}

@Override

public String toString() {

return “ObjectByStaff–>” + “Name:” + getName();

}

}

11.3

=================================================================

import java.util.Date;

public class dishiyizhang {

public static void main(String[] args) {

Account a = new Account(1, 2000);

CheckingAccount c = new CheckingAccount(114, 514, 1919);

Saving_Account s = new Saving_Account();

System.out.println(a.toString() + “\n” + c.toString() + “\n” + s.toString());

}

}

class Account {

private int id;

private double balance;

private double Rate;

private Date dateCreated;

public Account() {

id = 0;

balance = 0;

Rate = 0;

dateCreated = new Date();

}

public Account(int i, double b) {

id = i;

balance = b;

Rate = 0;

dateCreated = new Date();

}

public int getId() {

return id;

}

public void setId(int j) {

id = j;

}

public double getBalance() {

return balance;

}

public void setBalance(double j) {

balance = j;

}

public double getAnnualInterestRate() {

return Rate;

}

public void setAnnualInterestRate(double j) {

Rate = j;

}

public Date getDateCreated() {

return dateCreated;

}

public double getMonthlyInterestRate() {

return Rate / 12;

}

public double getMonthlyInterest() {

return Rate / 12 * balance;

}

public void withDraw(double m) {

balance -= m;

}

public void deposit(double m) {

balance += m;

}

}

class CheckingAccount extends Account {

private double overDraw;

public CheckingAccount() {

super();

}

public CheckingAccount(int i, double b, double o) {

super(i, b);

overDraw = o;

}

}

class Saving_Account extends Account {

//直接继承Account

}

11.4

=================================================================

import java.util.ArrayList;

import java.util.Scanner;

public class dishiyizhang {

public static void main(String[] args) {

System.out.print("Enter numbers (0 finished): ");

Scanner input = new Scanner(System.in);

ArrayList list = new ArrayList();

int n = input.nextInt();

while (n != 0) {

list.add(n);

n = input.nextInt();

}

System.out.println("The maximum is " + max(list));

}

public static Integer max(ArrayList list) {

if (list == null || list.size() == 0)

return null;

else

return java.util.Collections.max(list);

}

}

11.5

=================================================================

清单10-6.,,,,,前面的课程清单都找不到。。。看题目挺简单的,就是换成ArrayList来存储。

11.6

=================================================================

因为之前circle等的类都删除了,这里就写了一个Date对象,想要返回其他的再去看看前面课程吧。

import java.util.ArrayList;

import java.util.Date;

public class dishiyizhang {

public static void main(String[] args) {

ArrayList list = new ArrayList<>();

Date d = new Date();

list.add(d);

for(Object o: list)

System.out.println(o.toString());

}

}

11.7

=================================================================

import java.util.ArrayList;

public class dishiyizhang {

public static void main(String[] args) {

ArrayList list = new ArrayList<>();

list.add(1);

list.add(2);

list.add(3);

list.add(4);

shuffle(list);

System.out.println(list.toString());

}

public static void shuffle(ArrayList list){

java.util.Collections.shuffle(list);

}

}

11.8

=================================================================

import java.util.ArrayList;

import java.util.Date;

public class dishiyizhang {

public static void main(String[] args) {

Account a = new Account(1122, 1000, “George”);

a.deposit(1000, “First deposit”);

a.deposit(2000, “Second deposit”);

a.deposit(3000, “Third deposit”);

a.withDraw(1, “First withdraw”);

a.withDraw(2, “Sceond withdraw”);

a.withDraw(3, “Third withdraw”);

System.out.print(“name :” + a.getName() + " rate: " + a.getAnnualInterestRate() + " balance: " + a.getBalance() + “\n”);

for (Transaction b : a.transactions) {

System.out.println("date: " + b.date);

System.out.println("type: " + b.type);

System.out.println("amount: " + b.amount);

System.out.println("new balance: " + b.balance);

System.out.println("description: " + b.description);

}

}

}

class Account {

private int id;

private double balance;

private double Rate;

private Date dateCreated;

private String name;

ArrayList transactions;

public Account() {

id = 0;

balance = 0;

Rate = 0;

dateCreated = new Date();

transactions = new ArrayList();

}

public Account(int i, double b) {

id = i;

balance = b;

Rate = 0;

dateCreated = new Date();

transactions = new ArrayList();

}

public Account(int i, double b, String n) {

id = i;

balance = b;

Rate = 0;

dateCreated = new Date();

name = n;

transactions = new ArrayList();

}

public int getId() {

return id;

}

public void setId(int j) {

id = j;

}

public double getBalance() {

return balance;

}

public void setBalance(double j) {

balance = j;

}

public double getAnnualInterestRate() {

return Rate;

}

public void setAnnualInterestRate(double j) {

Rate = j;

}

public Date getDateCreated() {

return dateCreated;

}

public double getMonthlyInterestRate() {

return Rate / 12;

}

public double getMonthlyInterest() {

return Rate / 12 * balance;

}

public void withDraw(double m, String s) {

balance -= m;

transactions.add(new Transaction(‘W’, m, balance, s));

}

public void deposit(double m, String s) {

balance += m;

transactions.add(new Transaction(‘D’, m, balance, s));

}

public void setName(String n) {

name = n;

}

public String getName() {

return name;

}

}

class Transaction {

public Date date;

public char type;

public double amount;

public double balance;

public String description;

public Transaction(char c, double a, double b, String d) {

date = new Date();

type = c;

amount = a;

balance = b;

description = d;

}

}

11.9

=================================================================

import java.util.ArrayList;

import java.util.Scanner;

public class dishiyizhang {

public static void main(String[] args) {

System.out.print("Enter the array size n: ");

Scanner input = new Scanner(System.in);

int s = input.nextInt();

int[][] mt = new int[s][s];

ArrayList rows = new ArrayList<>();

ArrayList columns = new ArrayList<>();

for (int i = 0; i < s; i++) {

for (int j = 0; j < s; j++)

mt[i][j] = (int) (Math.random() * 2);

}

for (int i = 0; i < s; i++) {

int sum = 0;

for (int j = 0; j < s; j++) {

if (mt[i][j] == 1)

sum++;

}

rows.add(sum);

}

for (int j = 0; j < s; j++) {

int sum = 0;

最后

由于细节内容实在太多了,为了不影响文章的观赏性,只截出了一部分知识点大致的介绍一下,每个小节点里面都有更细化的内容!

小编准备了一份Java进阶学习路线图(Xmind)以及来年金三银四必备的一份《Java面试必备指南》

本文已被CODING开源项目:【一线大厂Java面试题解析+核心总结学习笔记+最新讲解视频+实战项目源码】收录

需要这份系统化的资料的朋友,可以点击这里获取

rray size n: ");

Scanner input = new Scanner(System.in);

int s = input.nextInt();

int[][] mt = new int[s][s];

ArrayList rows = new ArrayList<>();

ArrayList columns = new ArrayList<>();

for (int i = 0; i < s; i++) {

for (int j = 0; j < s; j++)

mt[i][j] = (int) (Math.random() * 2);

}

for (int i = 0; i < s; i++) {

int sum = 0;

for (int j = 0; j < s; j++) {

if (mt[i][j] == 1)

sum++;

}

rows.add(sum);

}

for (int j = 0; j < s; j++) {

int sum = 0;

最后

由于细节内容实在太多了,为了不影响文章的观赏性,只截出了一部分知识点大致的介绍一下,每个小节点里面都有更细化的内容!

[外链图片转存中…(img-fPml2sEH-1715452559211)]

小编准备了一份Java进阶学习路线图(Xmind)以及来年金三银四必备的一份《Java面试必备指南》

[外链图片转存中…(img-yUrB7x4R-1715452559212)]

本文已被CODING开源项目:【一线大厂Java面试题解析+核心总结学习笔记+最新讲解视频+实战项目源码】收录

需要这份系统化的资料的朋友,可以点击这里获取

  • 27
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值